diff options
author | Zhenhui Xie <xiezh0831@yahoo.co.jp> | 2019-10-25 09:08:09 +0800 |
---|---|---|
committer | Matan Kushner <hello@matchai.me> | 2019-10-25 10:08:09 +0900 |
commit | 321e44028929a63db2a551b470316e21f72c9791 (patch) | |
tree | 2b0faf393f544cd87482a3ce15ce286943fdb85e | |
parent | 9f22bce944f7afa92845b8a98aa104df06a17682 (diff) |
chore: Move StarshipRootConfig to a separate file (#581)
-rw-r--r-- | src/configs/mod.rs | 54 | ||||
-rw-r--r-- | src/configs/starship_root.rs | 52 |
2 files changed, 54 insertions, 52 deletions
diff --git a/src/configs/mod.rs b/src/configs/mod.rs index f313a24e7..0025c683d 100644 --- a/src/configs/mod.rs +++ b/src/configs/mod.rs @@ -17,58 +17,8 @@ pub mod package; pub mod python; pub mod ruby; pub mod rust; +mod starship_root; pub mod time; pub mod username; -use crate::config::{ModuleConfig, RootModuleConfig}; - -use starship_module_config_derive::ModuleConfig; - -#[derive(Clone, ModuleConfig)] -pub struct StarshipRootConfig<'a> { - pub add_newline: bool, - pub prompt_order: Vec<&'a str>, -} - -impl<'a> RootModuleConfig<'a> for StarshipRootConfig<'a> { - fn new() -> Self { - StarshipRootConfig { - add_newline: true, - // List of default prompt order - // NOTE: If this const value is changed then Default prompt order subheading inside - // prompt heading of config docs needs to be updated according to changes made here. - prompt_order: vec![ - "username", - "hostname", - "kubernetes", - "directory", - "git_branch", - "git_state", - "git_status", - "package", - // ↓ Toolchain version modules ↓ - // (Let's keep these sorted alphabetically) - "dotnet", - "golang", - "java", - "nodejs", - "python", - "ruby", - "rust", - // ↑ Toolchain version modules ↑ - "nix_shell", - "conda", - "memory_usage", - "aws", - "env_var", - "cmd_duration", - "line_break", - "jobs", - #[cfg(feature = "battery")] - "battery", - "time", - "character", - ], - } - } -} +pub use starship_root::*; diff --git a/src/configs/starship_root.rs b/src/configs/starship_root.rs new file mode 100644 index 000000000..bc0da2399 --- /dev/null +++ b/src/configs/starship_root.rs @@ -0,0 +1,52 @@ +use crate::config::{ModuleConfig, RootModuleConfig}; + +use starship_module_config_derive::ModuleConfig; + +#[derive(Clone, ModuleConfig)] +pub struct StarshipRootConfig<'a> { + pub add_newline: bool, + pub prompt_order: Vec<&'a str>, +} + +impl<'a> RootModuleConfig<'a> for StarshipRootConfig<'a> { + fn new() -> Self { + StarshipRootConfig { + add_newline: true, + // List of default prompt order + // NOTE: If this const value is changed then Default prompt order subheading inside + // prompt heading of config docs needs to be updated according to changes made here. + prompt_order: vec![ + "username", + "hostname", + "kubernetes", + "directory", + "git_branch", + "git_state", + "git_status", + "package", + // ↓ Toolchain version modules ↓ + // (Let's keep these sorted alphabetically) + "dotnet", + "golang", + "java", + "nodejs", + "python", + "ruby", + "rust", + // ↑ Toolchain version modules ↑ + "nix_shell", + "conda", + "memory_usage", + "aws", + "env_var", + "cmd_duration", + "line_break", + "jobs", + #[cfg(feature = "battery")] + "battery", + "time", + "character", + ], + } + } +} |