summaryrefslogtreecommitdiff
path: root/extra/source/bash-completion/contrib/pkgtools
blob: 2b438efcabd447facab1bd4e8f96b149c735bf11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# bash completion for Slackware Linux pkgtools

[ -f /etc/slackware-version ] &&
{

have pkgtool &&
_pkgtool()
{
    COMPREPLY=()
    local cur="${COMP_WORDS[COMP_CWORD]}"
    if [[ "$cur" == -* ]]; then
        COMPREPLY=( $( compgen -W '--sets --ignore-tagfiles --tagfile \
            --source-mounted --source_dir --target_dir --source_device' \
            -- "$cur" ) )
        return 0
    fi

    local prev=${COMP_WORDS[COMP_CWORD-1]}

    case $prev in
        --source_dir|--target_dir)
            _filedir -d
            return 0
            ;;
        --sets)
            # argument required but no completions available
            return 0
            ;;
        --source_device)
            COMPREPLY=( $( compgen -f -d -- "${cur:-/dev/}" ) )
            return 0
            ;;
        --tagfile)
            _filedir
            return 0
            ;;
    esac
} &&
complete -F _pkgtool pkgtool

have removepkg &&
_removepkg()
{
    COMPREPLY=()
    local cur=`_get_cword`
    if [[ "$cur" == -* ]]; then
        COMPREPLY=( $( compgen -W '-copy -keep -preserve -warn' \
            -- "$cur" ) )
        return 0
    fi

    COMPREPLY=( $( cd /var/log/packages; compgen -f -- "$cur" ) )
} &&
complete -F _removepkg removepkg

have upgradepkg &&
_upgradepkg()
{
    COMPREPLY=()
    local cur=`_get_cword`
    if [[ "$cur" == -* ]]; then
        COMPREPLY=( $( compgen -W '--dry-run --install-new --reinstall \
            --verbose' -- "$cur") )
        return 0
    fi

    _filedir "t[bglx]z"
} && complete -F _upgradepkg upgradepkg

have installpkg &&
_installpkg()
{
    COMPREPLY=()
    local cur=`_get_cword`
    if [[ "$cur" == -* ]]; then
        COMPREPLY=( $( compgen -W '--warn --md5sum --root --infobox --terse \
            --menu --ask --priority --tagfile' -- "$cur") )
        return 0
    fi

    local prev=`_get_pword`

    case $prev in
        --root)
            _filedir -d
            return 0
            ;;
        --priority)
            COMPREPLY=( $( compgen -W 'ADD REC OPT SKP' -- "$cur" ) )
            return 0
            ;;
        --tagfile)
            _filedir
            return 0
            ;;
    esac

    _filedir "t[bglx]z"
} && complete -F _installpkg installpkg

have makepkg &&
_makepkg()
{
    COMPREPLY=()
    local cur=`_get_cword`
    if [[ "$cur" == -* ]]; then
        COMPREPLY=( $( compgen -W '-l --linkadd -p --prepend \
            -c --chown' -- "$cur") )
        return 0
    fi

    local prev=`_get_pword`

    case $prev in
        -l|--linkadd|-c|--chown)
            COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
            return 0
            ;;
    esac

    _filedir
} && complete -F _makepkg makepkg

have explodepkg &&
complete -o plusdirs -f -X '!*.t[bglx]z' explodepkg

}