From fb6cefa4b51a6e6cb0dbf649e302b591b71b4d6f Mon Sep 17 00:00:00 2001 From: Eric Nielsen Date: Sat, 6 Mar 2021 14:47:06 -0500 Subject: style(aws): Add spacing between profile and region (#2417) and also after the symbol when using the Nerd font glyph. --- docs/config/README.md | 4 ++-- docs/presets/README.md | 2 +- src/configs/aws.rs | 2 +- src/modules/aws.rs | 46 +++++++++++++++++++++++++--------------------- 4 files changed, 29 insertions(+), 25 deletions(-) diff --git a/docs/config/README.md b/docs/config/README.md index b00a3e922..475981683 100644 --- a/docs/config/README.md +++ b/docs/config/README.md @@ -253,7 +253,7 @@ is read from the `AWS_VAULT` env var. | Option | Default | Description | | ---------------- | ---------------------------------------------- | --------------------------------------------------------------- | -| `format` | `'on [$symbol$profile(\($region\))]($style) '` | The format for the module. | +| `format` | `'on [$symbol($profile )(\($region\) )]($style)'` | The format for the module. | | `symbol` | `"☁️ "` | The symbol used before displaying the current AWS profile. | | `region_aliases` | | Table of region aliases to display in addition to the AWS name. | | `style` | `"bold yellow"` | The style for the module. | @@ -278,7 +278,7 @@ is read from the `AWS_VAULT` env var. # ~/.config/starship.toml [aws] -format = 'on [$symbol$profile(\($region\))]($style) ' +format = 'on [$symbol($profile )(\($region\) )]($style)' style = "bold blue" symbol = "🅰 " [aws.region_aliases] diff --git a/docs/presets/README.md b/docs/presets/README.md index 58f2b9425..f8939242c 100644 --- a/docs/presets/README.md +++ b/docs/presets/README.md @@ -18,7 +18,7 @@ If emojis aren't your thing, this might catch your eye! ```toml [aws] -symbol = " " +symbol = " " [conda] symbol = " " diff --git a/src/configs/aws.rs b/src/configs/aws.rs index 89a9d871d..2a033937d 100644 --- a/src/configs/aws.rs +++ b/src/configs/aws.rs @@ -14,7 +14,7 @@ pub struct AwsConfig<'a> { impl<'a> RootModuleConfig<'a> for AwsConfig<'a> { fn new() -> Self { AwsConfig { - format: "on [$symbol$profile(\\($region\\))]($style) ", + format: "on [$symbol($profile )(\\($region\\) )]($style)", symbol: "☁️ ", style: "bold yellow", disabled: false, diff --git a/src/modules/aws.rs b/src/modules/aws.rs index ed667d695..516a2d2ba 100644 --- a/src/modules/aws.rs +++ b/src/modules/aws.rs @@ -138,8 +138,8 @@ mod tests { .env("AWS_REGION", "ap-northeast-2") .collect(); let expected = Some(format!( - "on {} ", - Color::Yellow.bold().paint("☁️ (ap-northeast-2)") + "on {}", + Color::Yellow.bold().paint("☁️ (ap-northeast-2) ") )); assert_eq!(expected, actual); @@ -154,7 +154,7 @@ mod tests { ap-southeast-2 = "au" }) .collect(); - let expected = Some(format!("on {} ", Color::Yellow.bold().paint("☁️ (au)"))); + let expected = Some(format!("on {}", Color::Yellow.bold().paint("☁️ (au) "))); assert_eq!(expected, actual); } @@ -166,8 +166,8 @@ mod tests { .env("AWS_DEFAULT_REGION", "ap-northeast-1") .collect(); let expected = Some(format!( - "on {} ", - Color::Yellow.bold().paint("☁️ (ap-northeast-1)") + "on {}", + Color::Yellow.bold().paint("☁️ (ap-northeast-1) ") )); assert_eq!(expected, actual); @@ -179,8 +179,8 @@ mod tests { .env("AWS_PROFILE", "astronauts") .collect(); let expected = Some(format!( - "on {} ", - Color::Yellow.bold().paint("☁️ astronauts") + "on {}", + Color::Yellow.bold().paint("☁️ astronauts ") )); assert_eq!(expected, actual); @@ -193,8 +193,8 @@ mod tests { .env("AWS_PROFILE", "astronauts-profile") .collect(); let expected = Some(format!( - "on {} ", - Color::Yellow.bold().paint("☁️ astronauts-vault") + "on {}", + Color::Yellow.bold().paint("☁️ astronauts-vault ") )); assert_eq!(expected, actual); @@ -207,8 +207,10 @@ mod tests { .env("AWS_REGION", "ap-northeast-2") .collect(); let expected = Some(format!( - "on {} ", - Color::Yellow.bold().paint("☁️ astronauts(ap-northeast-2)") + "on {}", + Color::Yellow + .bold() + .paint("☁️ astronauts (ap-northeast-2) ") )); assert_eq!(expected, actual); @@ -234,8 +236,8 @@ region = us-east-2 .env("AWS_CONFIG_FILE", config_path.to_string_lossy().as_ref()) .collect(); let expected = Some(format!( - "on {} ", - Color::Yellow.bold().paint("☁️ (us-east-1)") + "on {}", + Color::Yellow.bold().paint("☁️ (us-east-1) ") )); assert_eq!(expected, actual); @@ -266,8 +268,8 @@ region = us-east-2 }) .collect(); let expected = Some(format!( - "on {} ", - Color::Yellow.bold().paint("☁️ astronauts(us-east-2)") + "on {}", + Color::Yellow.bold().paint("☁️ astronauts (us-east-2) ") )); assert_eq!(expected, actual); @@ -281,8 +283,10 @@ region = us-east-2 .env("AWS_REGION", "ap-northeast-1") .collect(); let expected = Some(format!( - "on {} ", - Color::Yellow.bold().paint("☁️ astronauts(ap-northeast-1)") + "on {}", + Color::Yellow + .bold() + .paint("☁️ astronauts (ap-northeast-1) ") )); assert_eq!(expected, actual); @@ -294,8 +298,8 @@ region = us-east-2 .env("AWS_PROFILE", "astronauts") .collect(); let expected = Some(format!( - "on {} ", - Color::Yellow.bold().paint("☁️ astronauts") + "on {}", + Color::Yellow.bold().paint("☁️ astronauts ") )); assert_eq!(expected, actual); @@ -307,8 +311,8 @@ region = us-east-2 .env("AWS_REGION", "ap-northeast-1") .collect(); let expected = Some(format!( - "on {} ", - Color::Yellow.bold().paint("☁️ (ap-northeast-1)") + "on {}", + Color::Yellow.bold().paint("☁️ (ap-northeast-1) ") )); assert_eq!(expected, actual); -- cgit v1.2.3