Skip to content

Commit e52c47b

Browse files
kwigleyedouard-lopez
authored andcommitted
docs: update doc and config tests
1 parent 4820bfd commit e52c47b

File tree

6 files changed

+44
-9
lines changed

6 files changed

+44
-9
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Fully **customizable** (colors, symbols and features):
4242
* [Display _username_ and _hostname_ when in an `SSH` session 🛠][ssh-session] ;
4343
* [Display command _duration_ when longer than `5` seconds 🛠][time-duration] ;
4444
* [Display `Python` _virtualenv_ when activated 🏴🛠][python-virtualenv] ;
45+
* [Display `AWS` profile when set 🏴🛠][aws-profile] ;
4546
* [Display `VI` mode and custom symbol for non-insert mode 🏴🛠][vi-mode] ;
4647
* [Display `kubernetes` context and namespace 🏴🛠][kubernetes] ;
4748
* [Detect when running in a container (e.g. `docker`, `podman`, `LXC`/`LXD`) 🏴🛠][container-detection-docker]
@@ -124,6 +125,7 @@ Checkout our [Contribution Guide][contribution] to get familiar with our convent
124125
[nix-os]: https://pure-fish.github.io/pure/#nix-os
125126
[prompt-symbol]: https://pure-fish.github.io/pure/#prompt-symbol
126127
[python-virtualenv]: https://pure-fish.github.io/pure/#python-virtualenv
128+
[aws-profile]: https://pure-fish.github.io/pure/#aws-profile
127129
[separate-error-symbol]: https://pure-fish.github.io/pure/#separate-error-symbol
128130
[single-line-prompt]: https://pure-fish.github.io/pure/#single-line-prompt
129131
[ssh-session]: https://pure-fish.github.io/pure/#ssh-session

conf.d/pure.fish

+2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ _pure_set_default pure_symbol_virtualenv_prefix "" # 🐍
6060
_pure_set_default pure_color_virtualenv pure_color_mute
6161

6262
# AWS profile name
63+
_pure_set_default pure_enable_aws_profile true
64+
_pure_set_default pure_symbol_aws_profile_prefix "" # ☁️
6365
_pure_set_default pure_color_aws_profile pure_color_warning
6466

6567
# Print current working directory at the beginning of prompt

docs/components/features-list.md

+7
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@
8282
| **`pure_enable_virtualenv`** | `true` | Show virtual env name (based on `VIRTUAL_ENV` or `CONDA_DEFAULT_ENV`). |
8383
| **`pure_symbol_virtualenv_prefix`** | | Prefix when a Python virtual env is activated (default: [undefined][to-set]) |
8484

85+
### AWS Profile
86+
87+
| Option | Default | Description |
88+
| :---------------------------------- | :------ | :--------------------------------------------------------------------------- |
89+
| **`pure_enable_aws_profile`** | `true` | Show AWS profile name (based on `AWS_VAULT` or `AWS_PROFILE`). |
90+
| **`pure_symbol_aws_profile_prefix`** | | Prefix when a AWS profile is activated (default: [undefined][to-set]) |
91+
8592
### Separate Error Symbol
8693

8794
| Option | Default | Description |

docs/components/features-overview.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Fully **customizable** (colors, symbols and features):
1313
* [Display _username_ and _hostname_ when in an `SSH` session 🛠][ssh-session] ;
1414
* [Display command _duration_ when longer than `5` seconds 🛠][time-duration] ;
1515
* [Display `Python` _virtualenv_ when activated 🏴🛠][python-virtualenv] ;
16-
* [Display `AWS` profile when set 🏴🛠][aws-profile] ;
16+
* [Display `AWS` profile when set 🏴🛠][aws-profile] ;
1717
* [Display `VI` mode and custom symbol for non-insert mode 🏴🛠][vi-mode] ;
1818
* [Display `kubernetes` context and namespace 🏴🛠][kubernetes] ;
1919
* [Detect when running in a container (e.g. `docker`, `podman`, `LXC`/`LXD`) 🏴🛠][container-detection-docker]
@@ -22,7 +22,7 @@ Fully **customizable** (colors, symbols and features):
2222
* [Show number of running jobs 🏴][jobs] ;
2323
* [Prefix when `root` 🏴🛠][working-as-root] ;
2424
* [Display `git` branch name 🏴🛠][git] ;
25-
25+
2626
* Display `*` when `git` repository is _dirty_ ;
2727
* Display `` when `git` repository is _stashed_ ;
2828
* Display `` when branch is _ahead_ (commits to push) ;
+13-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
function _pure_prompt_aws_profile --description "Display AWS profile name"
2-
if test -n "$AWS_VAULT"
3-
set --local aws_profile "$AWS_VAULT"
4-
set --local aws_profile_color (_pure_set_color $pure_color_aws_profile)
52

6-
echo "$aws_profile_color$aws_profile"
7-
else if test -n "$AWS_PROFILE" -o "$AWS_PROFILE" != default
8-
set --local aws_profile "$AWS_PROFILE"
3+
if set --query pure_enable_aws_profile;
4+
and test "$pure_enable_aws_profile" = true
5+
6+
set --local aws_profile ''
97
set --local aws_profile_color (_pure_set_color $pure_color_aws_profile)
108

11-
echo "$aws_profile_color$aws_profile"
9+
if test -n "$AWS_VAULT"
10+
set aws_profile "$AWS_VAULT"
11+
else if test -n "$AWS_PROFILE" -o "$AWS_PROFILE" != default
12+
set aws_profile "$AWS_PROFILE"
13+
end
14+
15+
if test -n $aws_profile
16+
echo "$pure_symbol_aws_profile_prefix$aws_profile_color$aws_profile"
17+
end
1218
end
1319
end

tests/_pure.test.fish

+18
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,24 @@ before_all
237237
echo $pure_color_virtualenv
238238
) = pure_color_mute
239239

240+
@test "configure: pure_enable_aws_profile" (
241+
set --erase pure_enable_aws_profile
242+
source (status dirname)/../conf.d/pure.fish
243+
echo $pure_enable_aws_profile
244+
) = true
245+
246+
@test "configure: pure_symbol_aws_profile_prefix" (
247+
set --erase pure_symbol_aws_profile_prefix
248+
source (status dirname)/../conf.d/pure.fish
249+
echo $pure_symbol_aws_profile_prefix
250+
) = $EMPTY
251+
252+
@test "configure: pure_color_aws_profile" (
253+
set --erase pure_color_aws_profile
254+
source (status dirname)/../conf.d/pure.fish
255+
echo $pure_color_aws_profile
256+
) = pure_color_warning
257+
240258
@test "configure: pure_begin_prompt_with_current_directory" (
241259
set --erase pure_begin_prompt_with_current_directory
242260
source (status dirname)/../conf.d/pure.fish

0 commit comments

Comments
 (0)