File tree Expand file tree Collapse file tree 6 files changed +18
-17
lines changed Expand file tree Collapse file tree 6 files changed +18
-17
lines changed Original file line number Diff line number Diff line change 55
66_comp_cmd_adb__command_usage ()
77{
8- COMPREPLY=($( compgen -W \
9- ' $("$1" help 2>&1 | command grep " ^ *\(adb \)\? *$2 " \
10- | command sed -e "s/[]|[]/\n/g" | _parse_help -)' -- " $cur " ) )
8+ COMPREPLY=($( compgen -W ' $("$1" help 2>&1 | \
9+ command sed -e "/ ^ *\(adb \)\{0,1\} *$2 /!d;s/[]|[]/\n/g" | \
10+ _parse_help -)' -- " $cur " ) )
1111}
1212
1313_comp_cmd_adb ()
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ _comp_cmd_udevadm()
88 local cur prev words cword was_split comp_args
99 _comp_initialize -s -- " $@ " || return
1010
11- local i udevcmd has_udevcmd=" "
11+ local i udevcmd= " " has_udevcmd=" "
1212 for (( i = 1 ; i < cword; i++ )) ; do
1313 if [[ ${words[i]} != -* ]]; then
1414 udevcmd=${words[i]}
@@ -69,7 +69,7 @@ _comp_cmd_udevadm()
6969
7070 if [[ $cur == -* ]]; then
7171 COMPREPLY=($( compgen -W \
72- ' $("$1" ${udevcmd-} --help 2>/dev/null | _parse_help - )' -- " $cur " ) )
72+ ' $(_parse_help "$1" " ${udevcmd-} --help" )' -- " $cur " ) )
7373 [[ ${COMPREPLY-} == * = ]] && compopt -o nospace
7474 fi
7575} &&
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ _comp_cmd_badblocks()
1717
1818 if [[ $cur == -* ]]; then
1919 # Filter out -w (dangerous) and -X (internal use)
20- COMPREPLY=($( compgen -X -[wX] -W ' $(_parse_usage "$1")' -- " $cur " ) )
20+ COMPREPLY=($( compgen -X ' -[wX]' -W ' $(_parse_usage "$1")' -- " $cur " ) )
2121 return
2222 fi
2323
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ _comp_cmd_complete()
4040 local -a opts=($( compgen -W ' $(_parse_usage help "-s $1")' -- " $cur " ) )
4141 # -F, -C do not work the expected way with compgen
4242 [[ $1 != * compgen ]] || opts=(" ${opts[@]// -[FC]/ } " )
43- COMPREPLY=($( compgen -W ' "${opts[@]}"' -- " $cur " ) )
43+ COMPREPLY=($( compgen -W ' "${opts[@]}"' -X ' ' - - " $cur " ) )
4444 else
4545 COMPREPLY=($( compgen -A command -- " $cur " ) )
4646 fi
Original file line number Diff line number Diff line change @@ -221,14 +221,18 @@ _comp_cmd_gnokii()
221221 esac
222222 fi
223223
224- # safer to use LANG=C
225- local all_cmd=" $( LANG=C _parse_help " $1 " " --help all" ) "
226- # these 2 below are allowed in combination with others
227- local main_cmd=$( command grep -v -- ' --config\|--phone' <<< " $all_cmd" )
224+ local all_cmd=" $( _parse_help " $1 " " --help all" ) "
228225
226+ # these 2 below are allowed in combination with others
227+ local main_cmd
228+ _comp_split -l main_cmd " $( command sed -e ' /--config/d;/--phone/d' -e \
229+ ' s/[][\(){}|^$*+?.]/\\&/g' <<< " $all_cmd" ) "
229230 # don't provide main command completions if one is
230231 # already on the command line
231- [[ $COMP_LINE =~ $( tr ' ' ' \b|' <<< " $main_cmd" ) ]] && return
232+ local IFS=' |'
233+ local regex_main_cmd=" (${main_cmd[*]} )($|[^_[:alnum:]])"
234+ IFS=$' \t\n '
235+ [[ $COMP_LINE =~ $regex_main_cmd ]] && return
232236
233237 COMPREPLY=($( compgen -W " $all_cmd " -- " $cur " ) )
234238} &&
Original file line number Diff line number Diff line change @@ -17,11 +17,8 @@ _comp_cmd_postfix()
1717 esac
1818
1919 if [[ $cur == -* ]]; then
20- COMPREPLY=($(
21- compgen -W \
22- ' $(_bashcomp_try_faketty "$1" --help 2>&1 | _parse_usage -)' \
23- -- " $cur "
24- ) )
20+ COMPREPLY=($( compgen -W \
21+ ' $(_parse_usage _bashcomp_try_faketty "$1 --help")' -- " $cur " ) )
2522 return
2623 fi
2724
You can’t perform that action at this time.
0 commit comments