2019-10-15 11:34:48 +00:00
|
|
|
use crate::config::{ModuleConfig, RootModuleConfig};
|
2020-10-13 19:06:41 +00:00
|
|
|
use indexmap::IndexMap;
|
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-10-13 19:06:41 +00:00
|
|
|
pub substitutions: IndexMap<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,
|
2020-10-03 16:25:21 +00:00
|
|
|
pub truncation_symbol: &'a str,
|
2021-01-24 21:50:37 +00:00
|
|
|
pub home_symbol: &'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-10-13 19:06:41 +00:00
|
|
|
substitutions: IndexMap::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",
|
2020-10-03 16:25:21 +00:00
|
|
|
truncation_symbol: "",
|
2021-01-24 21:50:37 +00:00
|
|
|
home_symbol: "~",
|
2019-10-15 11:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|