mirror of
https://github.com/ahmetb/kubectx.git
synced 2025-07-30 22:35:23 +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:
parent
f865312fb5
commit
aca0536725
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]}"
|
||||
|
Loading…
Reference in New Issue
Block a user