Skip to content

Commit

Permalink
Improve toggle segment visiblity script
Browse files Browse the repository at this point in the history
  • Loading branch information
j4ckofalltrades committed Jul 19, 2021
1 parent 248340d commit 1bc8365
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,24 @@ Alternatively you can add the following function to your shell for easier toggli

```shell
toggle_powerline_k8s() {
# pass the '-ns' or '--namespace' flag to toggle namespace visibility
if [[ "$1" == "-ns" || "$1" == "--namespace" ]]; then
if [[ "${POWERLINE_K8S_SHOW_NS:-0}" -eq 0 ]]; then
export POWERLINE_K8S_SHOW_NS=1
else
export POWERLINE_K8S_SHOW_NS=0
fi
else
# toggle segment visibility
if [[ "${POWERLINE_K8S_SHOW:-0}" -eq 0 ]]; then
export POWERLINE_K8S_SHOW=1
else
export POWERLINE_K8S_SHOW=0
fi
fi
case "$1" in
# pass the '-ns' flag to toggle namespace visibility
"-ns" | "--namespace")
if [[ "${POWERLINE_K8S_SHOW_NS:-1}" -eq 1 ]]; then
export POWERLINE_K8S_SHOW_NS=0
else
export POWERLINE_K8S_SHOW_NS=1
fi
;;
*)
# toggle segment visibility
if [[ "${POWERLINE_K8S_SHOW:-1}" -eq 1 ]]; then
export POWERLINE_K8S_SHOW=0
else
export POWERLINE_K8S_SHOW=1
fi
;;
esac
}
```

Expand Down

0 comments on commit 1bc8365

Please sign in to comment.