__parse_options: Remove trailing [().]* from completions.
This commit is contained in:
parent
50a0506c5b
commit
a52c4ea382
@ -703,12 +703,12 @@ __parse_options()
|
||||
# Expand --[no]foo to --foo and --nofoo etc
|
||||
if [[ $option =~ (\[((no|dont)-?)\]). ]]; then
|
||||
option2=${option/"${BASH_REMATCH[1]}"/}
|
||||
option2=${option2%%[<{[]*}
|
||||
option2=${option2%%[<{().[]*}
|
||||
printf '%s\n' "${option2/=*/=}"
|
||||
option=${option/"${BASH_REMATCH[1]}"/"${BASH_REMATCH[2]}"}
|
||||
fi
|
||||
|
||||
option=${option%%[<{[]*}
|
||||
option=${option%%[<{().[]*}
|
||||
printf '%s\n' "${option/=*/=}"
|
||||
}
|
||||
|
||||
|
@ -59,8 +59,7 @@ _mysql()
|
||||
|
||||
case $cur in
|
||||
--*)
|
||||
# TODO: fix _parse_help
|
||||
local help=$(_parse_help "$1"|sed -e 's/[.)]*$//')
|
||||
local help=$(_parse_help "$1")
|
||||
help+=" --skip-comment --skip-ssl"
|
||||
|
||||
COMPREPLY=( $( compgen -W "$help" -- "$cur" ) )
|
||||
|
@ -121,5 +121,9 @@ set cmd {fn() { printf '%s\n' "-f [FOO], --foo[=FOO]"; }; _parse_help fn}
|
||||
assert_bash_list "--foo" $cmd "-f \[FOO\], --foo\[=FOO\]"
|
||||
sync_after_int
|
||||
|
||||
set cmd {fn() { printf '%s\n' "--foo."; }; _parse_help fn}
|
||||
assert_bash_list "--foo" $cmd "--foo."
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
||||
|
Loading…
x
Reference in New Issue
Block a user