~ubuntu-branches/ubuntu/trusty/bash-completion/trusty-updates

« back to all changes in this revision

Viewing changes to completions/make

  • Committer: Package Import Robot
  • Author(s): Sebastien Bacher
  • Date: 2012-07-23 16:07:59 UTC
  • mfrom: (5.1.12 sid)
  • Revision ID: package-import@ubuntu.com-20120723160759-lt9vn33dl3nak9l0
Tags: 1:2.0-1ubuntu1
* debian/maintscript, debian/postinst:
  - clean etc conffiles on upgrade since completion files are in /usr
    with the new version
* Resync with Debian, remaining diff
  * debian/patches/disable-avahi-browse.diff: Disable avahi-browse since
    it scales poorly in the current form: refresh patch
  * patches/101_bash_completion.oga_ogv.patch: Increase support for other
    OGG formats including .oga, .ogx, etc. (LP: #311525)
  * patches/103_colormake.patch: Add support for colormake to the make
    completion rules. (LP: #743208)
* Dropped changes:
  * Add conffile upgrade handling for a run of conffiles that were dropped
    since lucid: lucid upgrades are only supported to precise.
* Those fixes are in the new version
  * debian/patches/apt-get-changelog.patch:
  * Drop whitelists if they fail to produce any results:
  * patches/apt-get-download.patch: Add download as an apt-get
    sub-command (LP: #720541)
  * patches/102_manpager.patch: Override MANPAGER when generating perldoc
    completions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# bash completion for GNU make
 
1
# bash completion for GNU make                             -*- shell-script -*-
2
2
 
3
 
have make || have gmake || have gnumake || have pmake || have colormake &&
4
3
_make()
5
4
{
6
 
    local file makef makef_dir="." makef_inc cur prev i split=false
7
 
 
8
 
    COMPREPLY=()
9
 
    _get_comp_words_by_ref cur prev
10
 
 
11
 
    _split_longopt && split=true
 
5
    local cur prev words cword split
 
6
    _init_completion -s || return
 
7
 
 
8
    local file makef makef_dir="." makef_inc i
12
9
 
13
10
    case $prev in
14
 
        -f|-o|-W|--file|--makefile|--old-file|--new-file|--assume-old|--assume-new|--what-if)
 
11
        -f|--file|--makefile|-o|--old-file|--assume-old|-W|--what-if|\
 
12
        --new-file|--assume-new)
15
13
            _filedir
16
14
            return 0
17
15
            ;;
18
 
        -I|-C|--directory|--include-dir)
 
16
        -I|--include-dir|-C|--directory|-m)
19
17
            _filedir -d
20
18
            return 0
21
19
            ;;
 
20
        -E)
 
21
            COMPREPLY=( $( compgen -v -- "$cur" ) )
 
22
            return 0
 
23
            ;;
 
24
        --eval|-D|-V|-x)
 
25
            return 0
 
26
            ;;
 
27
        --jobs|-j)
 
28
            COMPREPLY=( $( compgen -W "{1..$(( $(_ncpus)*2 ))}" -- "$cur" ) )
 
29
            return 0
 
30
            ;;
22
31
    esac
23
32
 
24
33
    $split && return 0
25
34
 
26
35
    if [[ "$cur" == -* ]]; then
27
 
        COMPREPLY=( $( compgen -W '-b -m -B -C -d -e -f -h -i -I\
28
 
            -j -l -k -n -o -p -q -r -R - s -S -t -v -w -W \
29
 
            --always-make --directory --debug \
30
 
            --environment-overrides --file --makefile --help \
31
 
            --ignore-errors --include-dir --jobs --load-average \
32
 
            --max-load --keep-going --just-print --dry-run \
33
 
            --recon --old-file --assume-old --print-data-base \
34
 
            --question --no-builtin-rules --no-builtin-variables \
35
 
            --silent --quiet --no-keep-goind --stop --touch \
36
 
            --version --print-directory --no-print-directory \
37
 
            --what-if --new-file --assume-new \
38
 
            --warn-undefined-variables' -- "$cur" ) )
 
36
        local opts="$( _parse_help "$1" )"
 
37
        [[ $opts ]] || opts="$( _parse_usage "$1" )"
 
38
        COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) )
 
39
        [[ $COMPREPLY == *= ]] && compopt -o nospace
 
40
    elif [[ $cur == *=* ]]; then
 
41
        prev=${cur%%=*}
 
42
        cur=${cur#*=}
 
43
        local diropt
 
44
        [[ ${prev,,} == *dir?(ectory) ]] && diropt=-d
 
45
        _filedir $diropt
39
46
    else
40
47
        # before we check for makefiles, see if a path was specified
41
48
        # with -C/--directory
42
 
        for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do
43
 
            if [[ ${COMP_WORDS[i]} == -@(C|-directory) ]]; then
 
49
        for (( i=0; i < ${#words[@]}; i++ )); do
 
50
            if [[ ${words[i]} == -@(C|-directory) ]]; then
44
51
                # eval for tilde expansion
45
 
                eval makef_dir=${COMP_WORDS[i+1]}
 
52
                eval makef_dir=${words[i+1]}
46
53
                break
47
54
            fi
48
55
        done
49
56
 
50
57
        # before we scan for targets, see if a Makefile name was
51
58
        # specified with -f/--file/--makefile
52
 
        for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do
53
 
            if [[ ${COMP_WORDS[i]} == -@(f|-?(make)file) ]]; then
 
59
        for (( i=0; i < ${#words[@]}; i++ )); do
 
60
            if [[ ${words[i]} == -@(f|-?(make)file) ]]; then
54
61
                # eval for tilde expansion
55
 
                eval makef=${COMP_WORDS[i+1]}
 
62
                eval makef=${words[i+1]}
56
63
                break
57
64
            fi
58
65
        done
59
66
 
60
 
        [ -n "$makef" ] && makef="-f ${makef}"
61
 
        [ -n "$makef_dir" ] && makef_dir="-C ${makef_dir}"
 
67
        [[ -n $makef ]] && makef="-f ${makef}"
 
68
        [[ -n $makef_dir ]] && makef_dir="-C ${makef_dir}"
62
69
 
63
70
        COMPREPLY=( $( compgen -W "$( make -qp $makef $makef_dir 2>/dev/null | \
64
71
            awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ \
69
76
} &&
70
77
complete -F _make make gmake gnumake pmake colormake
71
78
 
72
 
# Local variables:
73
 
# mode: shell-script
74
 
# sh-basic-offset: 4
75
 
# sh-indent-comment: t
76
 
# indent-tabs-mode: nil
77
 
# End:
78
79
# ex: ts=4 sw=4 et filetype=sh