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

« back to all changes in this revision

Viewing changes to completions/util-linux

  • Committer: Package Import Robot
  • Author(s): Angel Abad
  • Date: 2011-02-08 09:39:13 UTC
  • mfrom: (5.1.8 sid)
  • Revision ID: package-import@ubuntu.com-20110208093913-89h9hx9eq5j7vjpw
Tags: 1:1.3-1ubuntu1
* Merge from debian unstable. (LP: #715057) Remaining changes:
  - debian/patches/disable-avahi-browse.diff: Disable avahi-browse since
    it scales poorly in the current form:
    + Refresh patch
  - debian/patches/apt-get-changelog.patch:
    + Re-work patch because contrib dir no longer exists in upstream
      distribution.
* Dropped chages, applied upstream:
  - Fix p4 completion
  - Fix typo in openssl completion
  - Fix error while loading service(8) completions

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Completions for tools included in util-linux (not necessarily Linux specific)
 
2
 
 
3
# renice(8) completion
 
4
#
 
5
have renice &&
 
6
_renice()
 
7
{
 
8
    local command cur curopt i
 
9
 
 
10
    COMPREPLY=()
 
11
    _get_comp_words_by_ref cur
 
12
    command=$1
 
13
 
 
14
    i=0
 
15
    # walk back through command line and find last option
 
16
    while [[ $i -le $COMP_CWORD && ${#COMPREPLY[@]} -eq 0 ]]; do
 
17
        curopt=${COMP_WORDS[COMP_CWORD-$i]}
 
18
        case "$curopt" in
 
19
            -u)
 
20
                _allowed_users
 
21
                ;;
 
22
            -g)
 
23
                _pgids
 
24
                ;;
 
25
            -p|$command)
 
26
                _pids
 
27
                ;;
 
28
        esac
 
29
        i=$(( ++i ))
 
30
    done
 
31
} &&
 
32
complete -F _renice renice
 
33
 
 
34
# kill(1) completion
 
35
#
 
36
have kill &&
 
37
_kill()
 
38
{
 
39
    local cur
 
40
 
 
41
    COMPREPLY=()
 
42
    _get_comp_words_by_ref cur
 
43
 
 
44
    if [[ $COMP_CWORD -eq 1 && "$cur" == -* ]]; then
 
45
        # return list of available signals
 
46
        _signals
 
47
    else
 
48
        # return list of available PIDs
 
49
        _pids
 
50
    fi
 
51
} &&
 
52
complete -F _kill kill
 
53
 
 
54
# look(1) completion
 
55
#
 
56
have look &&
 
57
_look()
 
58
{
 
59
    local cur
 
60
 
 
61
    COMPREPLY=()
 
62
    _get_comp_words_by_ref cur
 
63
 
 
64
    if [ $COMP_CWORD = 1 ]; then
 
65
        COMPREPLY=( $( compgen -W '$(look "$cur" 2>/dev/null)' -- "$cur" ) )
 
66
    fi
 
67
} &&
 
68
complete -F _look -o default look
 
69
 
 
70
# Local variables:
 
71
# mode: shell-script
 
72
# sh-basic-offset: 4
 
73
# sh-indent-comment: t
 
74
# indent-tabs-mode: nil
 
75
# End:
 
76
# ex: ts=4 sw=4 et filetype=sh