mirror of
https://github.com/ahmetb/kubectx.git
synced 2025-07-19 17:49:18 +00:00
Print plugin-friendly usage string
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
This commit is contained in:
parent
9645e5c62c
commit
e2f7dc0de2
23
kubectx
23
kubectx
@ -22,22 +22,27 @@ set -eou pipefail
|
|||||||
IFS=$'\n\t'
|
IFS=$'\n\t'
|
||||||
|
|
||||||
SELF_CMD="$0"
|
SELF_CMD="$0"
|
||||||
|
SELF="kubectx"
|
||||||
|
if [[ "$(basename "$0")" == kubectl-* ]]; then # invoked as plugin
|
||||||
|
SELF="kubectl ctx"
|
||||||
|
fi
|
||||||
|
|
||||||
KUBECTX="${XDG_CACHE_HOME:-$HOME/.kube}/kubectx"
|
KUBECTX="${XDG_CACHE_HOME:-$HOME/.kube}/kubectx"
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat <<"EOF"
|
cat <<EOF
|
||||||
USAGE:
|
USAGE:
|
||||||
kubectx : list the contexts
|
$SELF : list the contexts
|
||||||
kubectx <NAME> : switch to context <NAME>
|
$SELF <NAME> : switch to context <NAME>
|
||||||
kubectx - : switch to the previous context
|
$SELF - : switch to the previous context
|
||||||
kubectx -c, --current : show the current context name
|
$SELF -c, --current : show the current context name
|
||||||
kubectx <NEW_NAME>=<NAME> : rename context <NAME> to <NEW_NAME>
|
$SELF <NEW_NAME>=<NAME> : rename context <NAME> to <NEW_NAME>
|
||||||
kubectx <NEW_NAME>=. : rename current-context to <NEW_NAME>
|
$SELF <NEW_NAME>=. : rename current-context to <NEW_NAME>
|
||||||
kubectx -d <NAME> [<NAME...>] : delete context <NAME> ('.' for current-context)
|
$SELF -d <NAME> [<NAME...>] : delete context <NAME> ('.' for current-context)
|
||||||
(this command won't delete the user/cluster entry
|
(this command won't delete the user/cluster entry
|
||||||
that is used by the context)
|
that is used by the context)
|
||||||
|
|
||||||
kubectx -h,--help : show this message
|
$SELF -h,--help : show this message
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
17
kubens
17
kubens
@ -22,16 +22,21 @@ set -eou pipefail
|
|||||||
IFS=$'\n\t'
|
IFS=$'\n\t'
|
||||||
|
|
||||||
SELF_CMD="$0"
|
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"
|
KUBENS_DIR="${XDG_CACHE_HOME:-$HOME/.kube}/kubens"
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat <<"EOF"
|
cat <<EOF
|
||||||
USAGE:
|
USAGE:
|
||||||
kubens : list the namespaces in the current context
|
$SELF : list the namespaces in the current context
|
||||||
kubens <NAME> : change the active namespace of current context
|
$SELF <NAME> : change the active namespace of current context
|
||||||
kubens - : switch to the previous namespace in this context
|
$SELF - : switch to the previous namespace in this context
|
||||||
kubens -c, --current : show the current namespace
|
$SELF -c, --current : show the current namespace
|
||||||
kubens -h,--help : show this message
|
$SELF -h,--help : show this message
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user