diff --git a/completions/_hwclock b/completions/_hwclock index 82619ee0363..a0fd8315288 100644 --- a/completions/_hwclock +++ b/completions/_hwclock @@ -18,8 +18,8 @@ _comp_cmd_hwclock() ;; esac - COMPREPLY=( - $(PATH="$PATH:/sbin" compgen -W '$(_parse_help "$1")' -- "$cur")) + local PATH=$PATH:/sbin + _comp_compgen_help } && complete -F _comp_cmd_hwclock hwclock diff --git a/completions/badblocks b/completions/badblocks index df84e280cc8..14e4e05ee83 100644 --- a/completions/badblocks +++ b/completions/badblocks @@ -17,7 +17,9 @@ _comp_cmd_badblocks() if [[ $cur == -* ]]; then # Filter out -w (dangerous) and -X (internal use) - COMPREPLY=($(compgen -X '-[wX]' -W '$(_parse_usage "$1")' -- "$cur")) + _comp_compgen -R usage + ((${#COMPREPLY[@]})) && + _comp_compgen -- -X '-[wX]' -W '"${COMPREPLY[@]}"' return fi diff --git a/completions/dnssec-keygen b/completions/dnssec-keygen index 4685af23786..9db55b5a232 100644 --- a/completions/dnssec-keygen +++ b/completions/dnssec-keygen @@ -37,8 +37,9 @@ _comp_cmd_dnssec_keygen() esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_help "$1" | \ - command sed -e "s/:\$//")' -- "$cur")) + _comp_compgen -R help + ((${#COMPREPLY[@]})) && + _comp_compgen -- -W '"${COMPREPLY[@]%:}"' return fi } && diff --git a/completions/jps b/completions/jps index f90ab7eaafc..be5b8d62151 100644 --- a/completions/jps +++ b/completions/jps @@ -12,8 +12,8 @@ _comp_cmd_jps() esac if [[ $cur == -* ]]; then - # Not using _parse_usage because output has [-help] which does not - # mean -h, -e, -l, -p... + # Not using _comp_compgen_usage because output has [-help] which does + # not mean -h, -e, -l, -p... _comp_compgen -- -W "-q -m -l -v -V -J -help" [[ ${COMPREPLY-} == -J* ]] && compopt -o nospace else diff --git a/completions/links b/completions/links index ea14d6ddc89..935cfa7816b 100644 --- a/completions/links +++ b/completions/links @@ -80,8 +80,9 @@ _comp_cmd_links() esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_help "$1" | - command grep -vF -- "->")' -- "$cur")) + _comp_compgen -R help + ((${#COMPREPLY[@]})) && + _comp_compgen -- -W '"${COMPREPLY[@]}"' -X "->" return fi diff --git a/completions/ps b/completions/ps index 1a7e2901005..d32083ecea4 100644 --- a/completions/ps +++ b/completions/ps @@ -56,7 +56,7 @@ _comp_cmd_ps() esac if [[ $cur == -* ]]; then - # sed: strip single char dashless ", x," that trip _parse_help + # sed: strip single char dashless ", x," that trip _comp_compgen_help _comp_compgen_help - <<<"$({ "$1" --help "$1" --help all diff --git a/completions/puppet b/completions/puppet index fbf5eeba045..91b8341e719 100644 --- a/completions/puppet +++ b/completions/puppet @@ -147,7 +147,8 @@ _comp_cmd_puppet() ;; *) _comp_cmd_puppet__subcmd_opts "$1" "$subcommand" - # _parse_usage doesn't grok [-D|--daemonize|--no-daemonize] + # _comp_compgen_usage doesn't grok + # [-D|--daemonize|--no-daemonize] _comp_compgen -a -- -W '--no-daemonize' return ;; @@ -298,7 +299,8 @@ _comp_cmd_puppet() ;; *) _comp_cmd_puppet__subcmd_opts "$1" "$subcommand" - # _parse_usage doesn't grok [-D|--daemonize|--no-daemonize] + # _comp_compgen_usage doesn't grok + # [-D|--daemonize|--no-daemonize] _comp_compgen -a -- -W '--no-daemonize' return ;; diff --git a/completions/tar b/completions/tar index 2c35491a68c..47d02f69ffb 100644 --- a/completions/tar +++ b/completions/tar @@ -19,8 +19,8 @@ # ------------------------- # # For GNU tar, everything is parsed from `tar --help` output so not so much -# per-distribution work should be needed. The _parse_help does not seem to be -# good enough so parsed here directly. +# per-distribution work should be needed. The _comp_compgen_help does not seem +# to be good enough so parsed here directly. # # # FIXME: --starting-file (-K) (should be matched for extraction only) diff --git a/completions/zopfli b/completions/zopfli index 735fc76da72..49d530589d6 100644 --- a/completions/zopfli +++ b/completions/zopfli @@ -12,8 +12,9 @@ _comp_cmd_zopfli() esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W \ - '$(_parse_help "$1" -h | command sed -e "s/#$//")' -- "$cur")) + _comp_compgen -R help -- -h + ((${#COMPREPLY[@]})) && + _comp_compgen -- -W '"${COMPREPLY[@]%#}"' [[ ${COMPREPLY-} == --i ]] && compopt -o nospace return fi