[go: nahoru, domu]

Skip to content

Commit

Permalink
help exit status 0 (ahmetb#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
tivvit authored and ahmetb committed Aug 19, 2018
1 parent 7bc9a12 commit e368d13
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion kubectx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ USAGE:
kubectx -h,--help : show this message
EOF
exit 1
}

current_context() {
Expand Down Expand Up @@ -176,11 +175,13 @@ main() {
if [[ "$#" -lt 2 ]]; then
echo "error: missing context NAME" >&2
usage
exit 1
fi
delete_contexts "${@:2}"
elif [[ "$#" -gt 1 ]]; then
echo "error: too many arguments" >&2
usage
exit 1
elif [[ "$#" -eq 1 ]]; then
if [[ "${1}" == "-" ]]; then
swap_context
Expand All @@ -189,13 +190,15 @@ main() {
elif [[ "${1}" =~ ^-(.*) ]]; then
echo "error: unrecognized flag \"${1}\"" >&2
usage
exit 1
elif [[ "${1}" =~ (.+)=(.+) ]]; then
rename_context "${BASH_REMATCH[2]}" "${BASH_REMATCH[1]}"
else
set_context "${1}"
fi
else
usage
exit 1
fi
}

Expand Down
3 changes: 2 additions & 1 deletion kubens
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ USAGE:
kubens - : switch to the previous namespace in this context
kubens -h,--help : show this message
EOF
exit 1
}

current_namespace() {
Expand Down Expand Up @@ -147,6 +146,7 @@ main() {
elif [[ "${1}" =~ ^-(.*) ]]; then
echo "error: unrecognized flag \"${1}\"" >&2
usage
exit 1
elif [[ "${1}" =~ (.+)=(.+) ]]; then
alias_context "${BASH_REMATCH[2]}" "${BASH_REMATCH[1]}"
else
Expand All @@ -155,6 +155,7 @@ main() {
else
echo "error: too many flags" >&2
usage
exit 1
fi
}

Expand Down

0 comments on commit e368d13

Please sign in to comment.