mirror of
https://github.com/ahmetb/kubectx.git
synced 2025-09-15 07:19:01 +00:00
Fix unrecognized flag handling
If the values in a=b format matches -(.*), unrecognized flag error is triggeed, using ^pattern to handle this. Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
This commit is contained in:
2
kubectx
2
kubectx
@@ -134,7 +134,7 @@ main() {
|
||||
swap_context
|
||||
elif [[ "${1}" == '-h' || "${1}" == '--help' ]]; then
|
||||
usage
|
||||
elif [[ "${1}" =~ -(.*) ]]; then
|
||||
elif [[ "${1}" =~ ^-(.*) ]]; then
|
||||
echo "error: unrecognized flag" >&2; usage
|
||||
elif [[ "${1}" =~ (.+)=(.+) ]]; then
|
||||
alias_context "${BASH_REMATCH[2]}" "${BASH_REMATCH[1]}"
|
||||
|
Reference in New Issue
Block a user