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

« back to all changes in this revision

Viewing changes to completions/modprobe

  • 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
# Linux modprobe(8) completion                             -*- shell-script -*-
 
2
 
 
3
_modprobe()
 
4
{
 
5
    local cur prev words cword
 
6
    _init_completion || return
 
7
 
 
8
    case "$prev" in
 
9
        -C|--config)
 
10
            _filedir
 
11
            return
 
12
            ;;
 
13
        -d|--dirname|-t|--type)
 
14
            _filedir -d
 
15
            return
 
16
            ;;
 
17
        -S|--set-version)
 
18
            _kernel_versions
 
19
            return
 
20
            ;;
 
21
    esac
 
22
 
 
23
    if [[ "$cur" == -* ]]; then
 
24
        COMPREPLY=( $( compgen -W '-a --all -b --use-blacklist -C --config -c
 
25
            --showconfig --dump-modversions -d --dirname --first-time
 
26
            --force-vermagic --force-modversion -f --force -i --ignore-install
 
27
            --ignore-remove -l --list -n --dry-run -q --quiet -R
 
28
            --resolve-alias -r --remove -S --set-version --show-depends -s
 
29
            --syslog -t --type -V --version -v --verbose' -- "$cur" ) )
 
30
        return
 
31
    fi
 
32
 
 
33
    local i mode=insert module= version=$(uname -r)
 
34
    for (( i=1; i < $cword; i++ )); do
 
35
        case "${words[i]}" in
 
36
            -r|--remove)
 
37
                mode=remove
 
38
                ;;
 
39
            -l|--list)
 
40
                mode=list
 
41
                ;;
 
42
            --dump-modversions)
 
43
                mode=file
 
44
                ;;
 
45
            -S|--set-version)
 
46
                version=${words[i+1]} # -S is not $prev and not $cur
 
47
                ;;
 
48
            -C|--config|-d|--dirname|-t|--type)
 
49
                ((i++)) # skip option and its argument
 
50
                ;;
 
51
            -*)
 
52
                # skip all other options
 
53
                ;;
 
54
            *)
 
55
                [ -z "$module" ] && module=${words[i]}
 
56
                ;;
 
57
        esac
 
58
    done
 
59
 
 
60
    case $mode in
 
61
        remove)
 
62
            _installed_modules "$cur"
 
63
            ;;
 
64
        list)
 
65
            # no completion available
 
66
            ;;
 
67
        file)
 
68
            _filedir
 
69
            ;;
 
70
        insert)
 
71
            # do filename completion if we're giving a path to a module
 
72
            if [[ "$cur" == @(*/|[.~])* ]]; then
 
73
                _filedir '@(?(k)o?(.gz))'
 
74
            elif [[ -n "$module" ]]; then
 
75
                # do module parameter completion
 
76
                COMPREPLY=( $( compgen -W "$( PATH="$PATH:/sbin" modinfo \
 
77
                    -p "$module" 2>/dev/null | cut -d: -f1 )" -- "$cur" ) )
 
78
            else
 
79
                _modules $version
 
80
            fi
 
81
            ;;
 
82
    esac
 
83
} &&
 
84
complete -F _modprobe modprobe
 
85
 
 
86
# ex: ts=4 sw=4 et filetype=sh