diff options
Diffstat (limited to 'completions/make')
-rw-r--r-- | completions/make | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/completions/make b/completions/make index 45d51168..f119dcc3 100644 --- a/completions/make +++ b/completions/make @@ -6,7 +6,7 @@ _make_target_extract_script() shift local prefix="$1" - local prefix_pat=$( command sed 's/[][\,.*^$(){}?+|/]/\\&/g' <<<"$prefix" ) + local prefix_pat=$(command sed 's/[][\,.*^$(){}?+|/]/\\&/g' <<<"$prefix") local basename=${prefix##*/} local dirname_len=$(( ${#prefix} - ${#basename} )) @@ -89,24 +89,24 @@ _make() local file makef makef_dir=( "-C" "." ) makef_inc i case $prev in - -f|--file|--makefile|-o|--old-file|--assume-old|-W|--what-if|\ - --new-file|--assume-new) + --file|--makefile|--old-file|--assume-old|--what-if| --new-file|\ + --assume-new|-!(-*)[foW]) _filedir return ;; - -I|--include-dir|-C|--directory|-m) + --include-dir|--directory|-!(-*)[ICm]) _filedir -d return ;; - -E) - COMPREPLY=( $( compgen -v -- "$cur" ) ) + -!(-*)E) + COMPREPLY=( $(compgen -v -- "$cur") ) return ;; - --eval|-D|-V|-x) + --eval|-!(-*)[DVx]) return ;; - --jobs|-j) - COMPREPLY=( $( compgen -W "{1..$(( $(_ncpus)*2 ))}" -- "$cur" ) ) + --jobs|-!(-*)j) + COMPREPLY=( $(compgen -W "{1..$(( $(_ncpus)*2 ))}" -- "$cur") ) return ;; esac @@ -114,9 +114,8 @@ _make() $split && return if [[ "$cur" == -* ]]; then - local opts="$( _parse_help "$1" )" - [[ $opts ]] || opts="$( _parse_usage "$1" )" - COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) + local opts="$(_parse_help "$1")" + COMPREPLY=( $(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace elif [[ $cur == *=* ]]; then prev=${cur%%=*} @@ -130,7 +129,7 @@ _make() for (( i=0; i < ${#words[@]}; i++ )); do if [[ ${words[i]} == -@(C|-directory) ]]; then # eval for tilde expansion - eval makef_dir=( -C "${words[i+1]}" ) + eval "makef_dir=( -C \"${words[i+1]}\" )" break fi done @@ -140,7 +139,7 @@ _make() for (( i=0; i < ${#words[@]}; i++ )); do if [[ ${words[i]} == -@(f|-?(make)file) ]]; then # eval for tilde expansion - eval makef=( -f "${words[i+1]}" ) + eval "makef=( -f \"${words[i+1]}\" )" break fi done @@ -152,11 +151,11 @@ _make() mode=-d # display-only mode fi - local IFS=$' \t\n' script=$( _make_target_extract_script $mode "$cur" ) - COMPREPLY=( $( LC_ALL=C \ + local IFS=$' \t\n' script=$(_make_target_extract_script $mode "$cur") + COMPREPLY=( $(LC_ALL=C \ $1 -npq __BASH_MAKE_COMPLETION__=1 \ "${makef[@]}" "${makef_dir[@]}" .DEFAULT 2>/dev/null | \ - command sed -ne "$script" ) ) + command sed -ne "$script") ) if [[ $mode != -d ]]; then # Completion will occur if there is only one suggestion |