mirror of
https://github.com/ahmetb/kubectx.git
synced 2025-06-25 06:51:55 +00:00
Detect invocation style only in usage() (#183)
- removes global SELF variable - fixes #181 Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
This commit is contained in:
parent
dcb43fdf1b
commit
56e30d2b43
10
kubectx
10
kubectx
@ -22,14 +22,16 @@ set -eou pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
SELF_CMD="$0"
|
||||
SELF="kubectx"
|
||||
if [[ "$(basename "$0")" == kubectl-* ]]; then # invoked as plugin
|
||||
SELF="kubectl ctx"
|
||||
fi
|
||||
|
||||
KUBECTX="${XDG_CACHE_HOME:-$HOME/.kube}/kubectx"
|
||||
|
||||
usage() {
|
||||
local SELF
|
||||
SELF="kubectx"
|
||||
if [[ "$(basename "$0")" == kubectl-* ]]; then # invoked as plugin
|
||||
SELF="kubectl ctx"
|
||||
fi
|
||||
|
||||
cat <<EOF
|
||||
USAGE:
|
||||
$SELF : list the contexts
|
||||
|
10
kubens
10
kubens
@ -22,14 +22,16 @@ set -eou pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
SELF_CMD="$0"
|
||||
SELF="kubens"
|
||||
if [[ "$(basename "$0")" == kubectl-* ]]; then # invoked as plugin
|
||||
SELF="kubectl ns"
|
||||
fi
|
||||
|
||||
KUBENS_DIR="${XDG_CACHE_HOME:-$HOME/.kube}/kubens"
|
||||
|
||||
usage() {
|
||||
local SELF
|
||||
SELF="kubens"
|
||||
if [[ "$(basename "$0")" == kubectl-* ]]; then # invoked as plugin
|
||||
SELF="kubectl ns"
|
||||
fi
|
||||
|
||||
cat <<EOF
|
||||
USAGE:
|
||||
$SELF : list the namespaces in the current context
|
||||
|
Loading…
Reference in New Issue
Block a user