diff options
author | David Paleino <dapal@debian.org> | 2011-11-03 12:32:52 +0100 |
---|---|---|
committer | David Paleino <dapal@debian.org> | 2011-11-03 12:32:52 +0100 |
commit | 2c8171c38d87ddef31c92a76547d3fdf773a1337 (patch) | |
tree | 5e720d5a06ead72ed55454bf6647a712a761ed91 /completions/make | |
parent | 9920a8faedf704420571d8072ccab27e9dac40ba (diff) | |
download | bash-completion-2c8171c38d87ddef31c92a76547d3fdf773a1337.tar.gz |
Imported Upstream version 1.90upstream/1.90
Diffstat (limited to 'completions/make')
-rw-r--r-- | completions/make | 57 |
1 files changed, 24 insertions, 33 deletions
diff --git a/completions/make b/completions/make index 76e95284..d56e1962 100644 --- a/completions/make +++ b/completions/make @@ -1,58 +1,55 @@ -# bash completion for GNU make +# bash completion for GNU make -*- shell-script -*- -have make || have gmake || have gnumake || have pmake && _make() { - local file makef makef_dir="." makef_inc cur prev i split=false + local cur prev words cword split + _init_completion -s || return - COMPREPLY=() - _get_comp_words_by_ref cur prev - - _split_longopt && split=true + local file makef makef_dir="." makef_inc i case $prev in - -f|-o|-W|--file|--makefile|--old-file|--new-file|--assume-old|--assume-new|--what-if) + -f|--file|--makefile|-o|--old-file|--assume-old|-W|--what-if|\ + --new-file|--assume-new) _filedir return 0 ;; - -I|-C|--directory|--include-dir) + -I|--include-dir|-C|--directory|-m) _filedir -d return 0 ;; + -E) + COMPREPLY=( $( compgen -v -- "$cur" ) ) + return 0 + ;; + --eval|-D|-V|-x) + return 0 + ;; esac $split && return 0 if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-b -m -B -C -d -e -f -h -i -I\ - -j -l -k -n -o -p -q -r -R - s -S -t -v -w -W \ - --always-make --directory --debug \ - --environment-overrides --file --makefile --help \ - --ignore-errors --include-dir --jobs --load-average \ - --max-load --keep-going --just-print --dry-run \ - --recon --old-file --assume-old --print-data-base \ - --question --no-builtin-rules --no-builtin-variables \ - --silent --quiet --no-keep-goind --stop --touch \ - --version --print-directory --no-print-directory \ - --what-if --new-file --assume-new \ - --warn-undefined-variables' -- "$cur" ) ) + local opts="$( _parse_help "$1" )" + [[ $opts ]] || opts="$( _parse_usage "$1" )" + COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace else # before we check for makefiles, see if a path was specified # with -C/--directory - for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do - if [[ ${COMP_WORDS[i]} == -@(C|-directory) ]]; then + for (( i=0; i < ${#words[@]}; i++ )); do + if [[ ${words[i]} == -@(C|-directory) ]]; then # eval for tilde expansion - eval makef_dir=${COMP_WORDS[i+1]} + eval makef_dir=${words[i+1]} break fi done # before we scan for targets, see if a Makefile name was # specified with -f/--file/--makefile - for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do - if [[ ${COMP_WORDS[i]} == -@(f|-?(make)file) ]]; then + for (( i=0; i < ${#words[@]}; i++ )); do + if [[ ${words[i]} == -@(f|-?(make)file) ]]; then # eval for tilde expansion - eval makef=${COMP_WORDS[i+1]} + eval makef=${words[i+1]} break fi done @@ -69,10 +66,4 @@ _make() } && complete -F _make make gmake gnumake pmake -# Local variables: -# mode: shell-script -# sh-basic-offset: 4 -# sh-indent-comment: t -# indent-tabs-mode: nil -# End: # ex: ts=4 sw=4 et filetype=sh |