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

« back to all changes in this revision

Viewing changes to completions/gcc

  • 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
 
# gcc(1) completion
 
1
# gcc(1) completion                                        -*- shell-script -*-
2
2
#
3
3
# The only unusual feature is that we don't parse "gcc --help -v" output
4
4
# directly, because that would include the options of all the other backend
8
8
# ask the driver ("g++") for the name of the compiler ("cc1"), and parse the
9
9
# --help output of the compiler.
10
10
 
11
 
have gcc &&
12
11
_gcc()
13
12
{
14
 
    local cur cc backend
15
 
 
16
 
    COMPREPLY=()
17
 
    _get_comp_words_by_ref cur
 
13
    local cur prev words cword
 
14
    _init_completion || return
18
15
 
19
16
    _expand || return 0
20
17
 
 
18
    local cc backend
 
19
 
21
20
    case $1 in
22
21
        gcj)
23
22
            backend=jc1
34
33
    esac
35
34
 
36
35
    if [[ "$cur" == -* ]]; then
37
 
        cc=$( $1 -print-prog-name=$backend )
 
36
        cc=$( $1 -print-prog-name=$backend 2>/dev/null )
 
37
        [[ $cc ]] || return
38
38
        # sink stderr:
39
39
        # for C/C++/ObjectiveC it's useless
40
40
        # for FORTRAN/Java it's an error
41
 
        COMPREPLY=( $( compgen -W "$( $cc --help 2>/dev/null | \
42
 
           tr '\t' ' ' | \
43
 
           sed -e '/^  *-/!d' -e 's/ *-\([^ ]*\).*/-\1/' | \
44
 
           sort -u )" -- "$cur" ) )
 
41
        COMPREPLY=( $( compgen -W "$( $cc --help 2>/dev/null | tr '\t' ' ' |\
 
42
           sed -e '/^  *-/!d' -e 's/ *-\([^][ <>]*\).*/-\1/' )" -- "$cur" ) )
 
43
        [[ $COMPREPLY == *= ]] && compopt -o nospace
45
44
    else
46
45
        _filedir
47
46
    fi
48
47
} &&
49
 
complete -F _gcc gcc g++ c++ g77 gcj gpc
50
 
[ $USERLAND = GNU -o $UNAME = Cygwin ] && \
51
 
[ -n "${have:-}" ] && complete -F _gcc cc
 
48
complete -F _gcc gcc g++ g77 gcj gpc &&
 
49
{
 
50
    cc  --version 2>/dev/null | grep -q GCC && complete -F _gcc cc  || :
 
51
    c++ --version 2>/dev/null | grep -q GCC && complete -F _gcc c++ || :
 
52
}
52
53
 
53
 
# Local variables:
54
 
# mode: shell-script
55
 
# sh-basic-offset: 4
56
 
# sh-indent-comment: t
57
 
# indent-tabs-mode: nil
58
 
# End:
59
54
# ex: ts=4 sw=4 et filetype=sh