summaryrefslogtreecommitdiffstats
path: root/src/configs/aws.rs
diff options
context:
space:
mode:
authorCédric Da Fonseca <Kwelity@users.noreply.github.com>2019-11-02 12:08:54 +0100
committerMatan Kushner <hello@matchai.me>2019-11-02 20:08:54 +0900
commitfa1267f12f60510d6214476e3d059edcb861f0c8 (patch)
tree1903487dcf0b89f475071a661c88fbc7f66c96aa /src/configs/aws.rs
parent26fa4ec1eaa611bcceab6239b005f29f06548778 (diff)
feat: Add configuration to set how much AWS profile info is shown (#556)
Diffstat (limited to 'src/configs/aws.rs')
-rw-r--r--src/configs/aws.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/configs/aws.rs b/src/configs/aws.rs
index a4dc4ca71..54dca3055 100644
--- a/src/configs/aws.rs
+++ b/src/configs/aws.rs
@@ -3,6 +3,13 @@ use crate::config::{ModuleConfig, RootModuleConfig, SegmentConfig};
use ansi_term::{Color, Style};
use starship_module_config_derive::ModuleConfig;
+#[derive(Clone, PartialEq)]
+pub enum AwsItems {
+ All,
+ Region,
+ Profile,
+}
+
#[derive(Clone, ModuleConfig)]
pub struct AwsConfig<'a> {
pub symbol: SegmentConfig<'a>,
@@ -10,6 +17,7 @@ pub struct AwsConfig<'a> {
pub region: SegmentConfig<'a>,
pub style: Style,
pub disabled: bool,
+ pub displayed_items: AwsItems,
}
impl<'a> RootModuleConfig<'a> for AwsConfig<'a> {
@@ -20,6 +28,18 @@ impl<'a> RootModuleConfig<'a> for AwsConfig<'a> {
region: SegmentConfig::default(),
style: Color::Yellow.bold(),
disabled: false,
+ displayed_items: AwsItems::All,
+ }
+ }
+}
+
+impl<'a> ModuleConfig<'a> for AwsItems {
+ fn from_config(config: &toml::Value) -> Option<Self> {
+ match config.as_str()? {
+ "all" => Some(AwsItems::All),
+ "region" => Some(AwsItems::Region),
+ "profile" => Some(AwsItems::Profile),
+ _ => None,
}
}
}