From 248340dcb0e5f25bfa348424d06a6630023fd50f Mon Sep 17 00:00:00 2001 From: Jordan Duabe Date: Mon, 19 Jul 2021 00:05:43 +0800 Subject: [PATCH] Update toggle segment visibility instructions --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index 3b27434..f86a35d 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,8 @@ Toggle entire segment or specific section's visibility with the following enviro - `POWERLINE_K8S_SHOW` - `POWERLINE_K8S_SHOW_NS` +Note: Full segment visibility takes precedence over namespace section visibility. + ```shell # toggle segment visibility $ POWERLINE_K8S_SHOW=0 powerline-daemon --replace # hide powerline-k8s segment @@ -68,6 +70,28 @@ $ POWERLINE_K8S_SHOW_NS=0 powerline-daemon --replace # hide namespace section $ POWERLINE_K8S_SHOW_NS=1 powerline-daemon --replace # show namespace section (default) ``` +Alternatively you can add the following function to your shell for easier toggling: + +```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 +} +``` + ## Docs For more detailed documentation see [https://j4ckofalltrades.github.io/powerline-k8s](https://j4ckofalltrades.github.io/powerline-k8s).