Skip to content

Commit

Permalink
Merge pull request #214 from noseglid/master
Browse files Browse the repository at this point in the history
Simplify kubernetes context fetching
  • Loading branch information
bobthecow authored Feb 29, 2020
2 parents 5ed60e0 + 740150d commit dbe3009
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ set -g theme_newline_prompt '$ '
- `theme_display_vagrant`. This feature is disabled by default, use `yes` to display Vagrant status in your prompt. Please note that only the VirtualBox and VMWare providers are supported.
- `theme_display_vi`. By default the vi mode indicator will be shown if vi or hybrid key bindings are enabled. Use `no` to hide the indicator, or `yes` to show the indicator.
- `theme_display_k8s_context`. This feature is disabled by default. Use `yes` to show the current kubernetes context (`> kubectl config current-context`).
- `theme_display_k8s_namespace`. This feature is disabled by default. Use `yes` to show the current kubernetes namespace.
- `theme_display_user`. If set to `yes`, display username always, if set to `ssh`, only when an SSH-Session is detected, if set to no, never.
- `theme_display_hostname`. Same behaviour as `theme_display_user`.
- `theme_display_sudo_user`. If set to `yes`, displays the sudo-username in a root shell. For example, when calling `sudo -s` and having this option set to `yes`, the username of the user, who called `sudo -s`, will be displayed.
Expand Down
4 changes: 3 additions & 1 deletion fish_prompt.fish
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
# set -g theme_display_vagrant yes
# set -g theme_display_docker_machine no
# set -g theme_display_k8s_context yes
# set -g theme_display_k8s_namespace no
# set -g theme_display_hg yes
# set -g theme_display_virtualenv no
# set -g theme_display_ruby no
Expand Down Expand Up @@ -639,7 +640,8 @@ function __bobthefish_prompt_k8s_context -S -d 'Show current Kubernetes context'
set -l context (__bobthefish_k8s_context)
or return

set -l namespace (__bobthefish_k8s_namespace)
[ "$theme_display_k8s_namespace" = 'yes' ]
and set -l namespace (__bobthefish_k8s_namespace)

set -l segment $k8s_glyph " " $context
[ -n "$namespace" ]
Expand Down

0 comments on commit dbe3009

Please sign in to comment.