~ubuntu-branches/ubuntu/vivid/bash-completion/vivid-proposed

« back to all changes in this revision

Viewing changes to contrib/module-init-tools

  • Committer: Package Import Robot
  • Author(s): David Paleino
  • Date: 2011-02-06 22:00:58 UTC
  • mfrom: (1.1.4)
  • mto: (5.1.9 sid)
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20110206220058-zfh1gyor3vp1goqc
Tags: 1:1.3-1
* New upstream release
  - Fixed "service" completion, thanks to John Hedges (Closes: #586210)
  - Fixed typo in openssl completion (Closes: #609552)
  - Added ip completion (Closes: #600617)
  - Added _tilde(), fix ~username completion (Closes: #587095)
  - Add *.webm to mplayer file completions (Closes: #588079).
* debian/watch: fix to handle .tar.bz2 files
* Bump Standards-Version to 3.9.1, no changes needed
* Install upstream CHANGES file
* Update copyright years in debian/copyright
* debian/rules: reflect new source layout

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# bash completion for Linux module-init-tools
2
 
 
3
 
# Linux rmmod(8) completion. This completes on a list of all currently
4
 
# installed kernel modules.
5
 
#
6
 
have rmmod &&
7
 
_rmmod()
8
 
{
9
 
    local cur
10
 
 
11
 
    COMPREPLY=()
12
 
    _get_comp_words_by_ref cur
13
 
 
14
 
    _installed_modules "$cur"
15
 
    return 0
16
 
} &&
17
 
complete -F _rmmod rmmod
18
 
 
19
 
# Linux insmod(8), modprobe(8) and modinfo(8) completion. This completes on a
20
 
# list of all available modules for the version of the kernel currently
21
 
# running.
22
 
#
23
 
have insmod || have modprobe || have modinfo &&
24
 
_insmod()
25
 
{
26
 
    local cur prev modpath
27
 
 
28
 
    COMPREPLY=()
29
 
    _get_comp_words_by_ref cur prev
30
 
 
31
 
    # behave like lsmod for modprobe -r
32
 
    if [[ ${1##*/} == modprobe && "${COMP_WORDS[1]}" == -r ]]; then
33
 
        _installed_modules "$cur"
34
 
        return 0
35
 
    fi
36
 
 
37
 
    # do filename completion if we're giving a path to a module
38
 
    if [[ "$cur" == */* ]]; then
39
 
        _filedir '@(?(k)o?(.gz))'
40
 
        return 0
41
 
    fi
42
 
 
43
 
    if [[ $COMP_CWORD -gt 1 && "${COMP_WORDS[COMP_CWORD-1]}" != -* ]]; then
44
 
        # do module parameter completion
45
 
        COMPREPLY=( $( compgen -W "$( /sbin/modinfo -p ${COMP_WORDS[1]} | \
46
 
            cut -d: -f1 )" -- "$cur" ) )
47
 
    else
48
 
        _modules $(uname -r)
49
 
    fi
50
 
 
51
 
    return 0
52
 
} &&
53
 
complete -F _insmod -o filenames insmod modprobe modinfo
54
 
 
55
 
# Local variables:
56
 
# mode: shell-script
57
 
# sh-basic-offset: 4
58
 
# sh-indent-comment: t
59
 
# indent-tabs-mode: nil
60
 
# End:
61
 
# ex: ts=4 sw=4 et filetype=sh