2019-10-15 11:34:48 +00:00
|
|
|
use crate::config::{ModuleConfig, RootModuleConfig};
|
2020-05-31 17:32:35 +00:00
|
|
|
use std::collections::HashMap;
|
2019-10-15 11:34:48 +00:00
|
|
|
|
|
|
|
use starship_module_config_derive::ModuleConfig;
|
|
|
|
|
|
|
|
#[derive(Clone, ModuleConfig)]
|
2019-12-06 19:19:11 +00:00
|
|
|
pub struct DirectoryConfig<'a> {
|
2019-10-15 11:34:48 +00:00
|
|
|
pub truncation_length: i64,
|
|
|
|
pub truncate_to_repo: bool,
|
2020-05-31 17:32:35 +00:00
|
|
|
pub substitutions: HashMap<String, &'a str>,
|
2019-10-15 11:34:48 +00:00
|
|
|
pub fish_style_pwd_dir_length: i64,
|
|
|
|
pub use_logical_path: bool,
|
2020-07-07 22:45:32 +00:00
|
|
|
pub format: &'a str,
|
|
|
|
pub style: &'a str,
|
2019-10-15 11:34:48 +00:00
|
|
|
pub disabled: bool,
|
2020-10-02 17:10:46 +00:00
|
|
|
pub read_only: &'a str,
|
|
|
|
pub read_only_style: &'a str,
|
2019-10-15 11:34:48 +00:00
|
|
|
}
|
|
|
|
|
2019-12-06 19:19:11 +00:00
|
|
|
impl<'a> RootModuleConfig<'a> for DirectoryConfig<'a> {
|
2019-10-15 11:34:48 +00:00
|
|
|
fn new() -> Self {
|
|
|
|
DirectoryConfig {
|
|
|
|
truncation_length: 3,
|
|
|
|
truncate_to_repo: true,
|
|
|
|
fish_style_pwd_dir_length: 0,
|
2020-05-31 17:32:35 +00:00
|
|
|
substitutions: HashMap::new(),
|
2019-10-15 11:34:48 +00:00
|
|
|
use_logical_path: true,
|
2020-07-13 21:55:42 +00:00
|
|
|
format: "[$path]($style)[$read_only]($read_only_style) ",
|
2020-07-07 22:45:32 +00:00
|
|
|
style: "cyan bold",
|
2019-10-15 11:34:48 +00:00
|
|
|
disabled: false,
|
2020-10-02 17:10:46 +00:00
|
|
|
read_only: "🔒",
|
|
|
|
read_only_style: "red",
|
2019-10-15 11:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|