mirror of
https://github.com/ahmetb/kubectx.git
synced 2025-08-10 19:52:10 +00:00
help exit status 0 (#72)
This commit is contained in:
parent
7bc9a1277c
commit
e368d13eea
5
kubectx
5
kubectx
@ -37,7 +37,6 @@ USAGE:
|
|||||||
|
|
||||||
kubectx -h,--help : show this message
|
kubectx -h,--help : show this message
|
||||||
EOF
|
EOF
|
||||||
exit 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
current_context() {
|
current_context() {
|
||||||
@ -176,11 +175,13 @@ main() {
|
|||||||
if [[ "$#" -lt 2 ]]; then
|
if [[ "$#" -lt 2 ]]; then
|
||||||
echo "error: missing context NAME" >&2
|
echo "error: missing context NAME" >&2
|
||||||
usage
|
usage
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
delete_contexts "${@:2}"
|
delete_contexts "${@:2}"
|
||||||
elif [[ "$#" -gt 1 ]]; then
|
elif [[ "$#" -gt 1 ]]; then
|
||||||
echo "error: too many arguments" >&2
|
echo "error: too many arguments" >&2
|
||||||
usage
|
usage
|
||||||
|
exit 1
|
||||||
elif [[ "$#" -eq 1 ]]; then
|
elif [[ "$#" -eq 1 ]]; then
|
||||||
if [[ "${1}" == "-" ]]; then
|
if [[ "${1}" == "-" ]]; then
|
||||||
swap_context
|
swap_context
|
||||||
@ -189,6 +190,7 @@ main() {
|
|||||||
elif [[ "${1}" =~ ^-(.*) ]]; then
|
elif [[ "${1}" =~ ^-(.*) ]]; then
|
||||||
echo "error: unrecognized flag \"${1}\"" >&2
|
echo "error: unrecognized flag \"${1}\"" >&2
|
||||||
usage
|
usage
|
||||||
|
exit 1
|
||||||
elif [[ "${1}" =~ (.+)=(.+) ]]; then
|
elif [[ "${1}" =~ (.+)=(.+) ]]; then
|
||||||
rename_context "${BASH_REMATCH[2]}" "${BASH_REMATCH[1]}"
|
rename_context "${BASH_REMATCH[2]}" "${BASH_REMATCH[1]}"
|
||||||
else
|
else
|
||||||
@ -196,6 +198,7 @@ main() {
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
usage
|
usage
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
3
kubens
3
kubens
@ -31,7 +31,6 @@ USAGE:
|
|||||||
kubens - : switch to the previous namespace in this context
|
kubens - : switch to the previous namespace in this context
|
||||||
kubens -h,--help : show this message
|
kubens -h,--help : show this message
|
||||||
EOF
|
EOF
|
||||||
exit 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
current_namespace() {
|
current_namespace() {
|
||||||
@ -147,6 +146,7 @@ main() {
|
|||||||
elif [[ "${1}" =~ ^-(.*) ]]; then
|
elif [[ "${1}" =~ ^-(.*) ]]; then
|
||||||
echo "error: unrecognized flag \"${1}\"" >&2
|
echo "error: unrecognized flag \"${1}\"" >&2
|
||||||
usage
|
usage
|
||||||
|
exit 1
|
||||||
elif [[ "${1}" =~ (.+)=(.+) ]]; then
|
elif [[ "${1}" =~ (.+)=(.+) ]]; then
|
||||||
alias_context "${BASH_REMATCH[2]}" "${BASH_REMATCH[1]}"
|
alias_context "${BASH_REMATCH[2]}" "${BASH_REMATCH[1]}"
|
||||||
else
|
else
|
||||||
@ -155,6 +155,7 @@ main() {
|
|||||||
else
|
else
|
||||||
echo "error: too many flags" >&2
|
echo "error: too many flags" >&2
|
||||||
usage
|
usage
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user