1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-06-22 09:55:10 +00:00
starship/src/configs/directory.rs
Segev Finer 1c305c9de7
feat(directory): Windows path formatting via path_slash::PathBufExt (#3157)
* feat: Experimental Windows path formatting via path_slash::PathBufExt

* Rework the slash path conversion into a real PR

* Add a test for convert_slash = false

* Attempt fixing CI failures

* Fix lint and fmt

* Fix docs/config/README.md getting messed up

* Rename convert_slash/from_slash

* Move convert_path_sep calls in tests

* Keep path_vec immutable

* Run rustfmt
2021-12-30 09:57:13 +01:00

47 lines
1.4 KiB
Rust

use crate::config::ModuleConfig;
use indexmap::IndexMap;
use serde::Serialize;
use starship_module_config_derive::ModuleConfig;
#[derive(Clone, ModuleConfig, Serialize)]
pub struct DirectoryConfig<'a> {
pub truncation_length: i64,
pub truncate_to_repo: bool,
pub substitutions: IndexMap<String, &'a str>,
pub fish_style_pwd_dir_length: i64,
pub use_logical_path: bool,
pub format: &'a str,
pub repo_root_format: &'a str,
pub style: &'a str,
pub repo_root_style: Option<&'a str>,
pub disabled: bool,
pub read_only: &'a str,
pub read_only_style: &'a str,
pub truncation_symbol: &'a str,
pub home_symbol: &'a str,
pub use_os_path_sep: bool,
}
impl<'a> Default for DirectoryConfig<'a> {
fn default() -> Self {
DirectoryConfig {
truncation_length: 3,
truncate_to_repo: true,
fish_style_pwd_dir_length: 0,
use_logical_path: true,
substitutions: IndexMap::new(),
format: "[$path]($style)[$read_only]($read_only_style) ",
repo_root_format: "[$before_root_path]($style)[$repo_root]($repo_root_style)[$path]($style)[$read_only]($read_only_style) ",
style: "cyan bold",
repo_root_style: None,
disabled: false,
read_only: "🔒",
read_only_style: "red",
truncation_symbol: "",
home_symbol: "~",
use_os_path_sep: true,
}
}
}