diff options
author | Zhenhui Xie <xiezh0831@yahoo.co.jp> | 2019-10-19 09:51:38 +0800 |
---|---|---|
committer | Matan Kushner <hello@matchai.me> | 2019-10-19 10:51:38 +0900 |
commit | aadd8ecf2c0f3bdbb9684f900fee66b13f47c061 (patch) | |
tree | d2ff151e7bdc0de6c9b89e4723a3df23025aa957 /src/configs | |
parent | 09353fff005b2b983fe9917df662483b9669dd64 (diff) |
refactor: Refactor modules to use module config (#514)
Diffstat (limited to 'src/configs')
-rw-r--r-- | src/configs/mod.rs | 5 | ||||
-rw-r--r-- | src/configs/nodejs.rs | 21 | ||||
-rw-r--r-- | src/configs/package.rs | 21 | ||||
-rw-r--r-- | src/configs/python.rs | 27 | ||||
-rw-r--r-- | src/configs/ruby.rs | 21 | ||||
-rw-r--r-- | src/configs/username.rs | 23 |
6 files changed, 118 insertions, 0 deletions
diff --git a/src/configs/mod.rs b/src/configs/mod.rs index 4f1a90b51..95743df1c 100644 --- a/src/configs/mod.rs +++ b/src/configs/mod.rs @@ -11,8 +11,13 @@ pub mod go; pub mod hostname; pub mod jobs; pub mod kubernetes; +pub mod nodejs; +pub mod package; +pub mod python; +pub mod ruby; pub mod rust; pub mod time; +pub mod username; use crate::config::{ModuleConfig, RootModuleConfig}; diff --git a/src/configs/nodejs.rs b/src/configs/nodejs.rs new file mode 100644 index 000000000..5faee3fe0 --- /dev/null +++ b/src/configs/nodejs.rs @@ -0,0 +1,21 @@ +use crate::config::{ModuleConfig, RootModuleConfig, SegmentConfig}; + +use ansi_term::{Color, Style}; +use starship_module_config_derive::ModuleConfig; + +#[derive(Clone, ModuleConfig)] +pub struct NodejsConfig<'a> { + pub symbol: SegmentConfig<'a>, + pub style: Style, + pub disabled: bool, +} + +impl<'a> RootModuleConfig<'a> for NodejsConfig<'a> { + fn new() -> Self { + NodejsConfig { + symbol: SegmentConfig::new("⬢ "), + style: Color::Green.bold(), + disabled: false, + } + } +} diff --git a/src/configs/package.rs b/src/configs/package.rs new file mode 100644 index 000000000..92417a294 --- /dev/null +++ b/src/configs/package.rs @@ -0,0 +1,21 @@ +use crate::config::{ModuleConfig, RootModuleConfig, SegmentConfig}; + +use ansi_term::{Color, Style}; +use starship_module_config_derive::ModuleConfig; + +#[derive(Clone, ModuleConfig)] +pub struct PackageConfig<'a> { + pub symbol: SegmentConfig<'a>, + pub style: Style, + pub disabled: bool, +} + +impl<'a> RootModuleConfig<'a> for PackageConfig<'a> { + fn new() -> Self { + PackageConfig { + symbol: SegmentConfig::new("📦 "), + style: Color::Red.bold(), + disabled: false, + } + } +} diff --git a/src/configs/python.rs b/src/configs/python.rs new file mode 100644 index 000000000..736283f4f --- /dev/null +++ b/src/configs/python.rs @@ -0,0 +1,27 @@ +use crate::config::{ModuleConfig, RootModuleConfig, SegmentConfig}; + +use ansi_term::{Color, Style}; +use starship_module_config_derive::ModuleConfig; + +#[derive(Clone, ModuleConfig)] +pub struct PythonConfig<'a> { + pub symbol: SegmentConfig<'a>, + pub version: SegmentConfig<'a>, + pub pyenv_prefix: SegmentConfig<'a>, + pub pyenv_version_name: bool, + pub style: Style, + pub disabled: bool, +} + +impl<'a> RootModuleConfig<'a> for PythonConfig<'a> { + fn new() -> Self { + PythonConfig { + symbol: SegmentConfig::new("🐍 "), + version: SegmentConfig::default(), + pyenv_prefix: SegmentConfig::new("pyenv "), + pyenv_version_name: false, + style: Color::Yellow.bold(), + disabled: false, + } + } +} diff --git a/src/configs/ruby.rs b/src/configs/ruby.rs new file mode 100644 index 000000000..82d1d03eb --- /dev/null +++ b/src/configs/ruby.rs @@ -0,0 +1,21 @@ +use crate::config::{ModuleConfig, RootModuleConfig, SegmentConfig}; + +use ansi_term::{Color, Style}; +use starship_module_config_derive::ModuleConfig; + +#[derive(Clone, ModuleConfig)] +pub struct RubyConfig<'a> { + pub symbol: SegmentConfig<'a>, + pub style: Style, + pub disabled: bool, +} + +impl<'a> RootModuleConfig<'a> for RubyConfig<'a> { + fn new() -> Self { + RubyConfig { + symbol: SegmentConfig::new("💎 "), + style: Color::Red.bold(), + disabled: false, + } + } +} diff --git a/src/configs/username.rs b/src/configs/username.rs new file mode 100644 index 000000000..8414fe68c --- /dev/null +++ b/src/configs/username.rs @@ -0,0 +1,23 @@ +use crate::config::{ModuleConfig, RootModuleConfig}; + +use ansi_term::{Color, Style}; +use starship_module_config_derive::ModuleConfig; + +#[derive(Clone, ModuleConfig)] +pub struct UsernameConfig { + pub style_root: Style, + pub style_user: Style, + pub show_always: bool, + pub disabled: bool, +} + +impl<'a> RootModuleConfig<'a> for UsernameConfig { + fn new() -> Self { + UsernameConfig { + style_root: Color::Red.bold(), + style_user: Color::Yellow.bold(), + show_always: false, + disabled: false, + } + } +} |