diff --git a/README.md b/README.md index f86a35d..0c128f7 100644 --- a/README.md +++ b/README.md @@ -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 } ```