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

« back to all changes in this revision

Viewing changes to completions/postfix

  • 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
 
# bash completion for postfix
 
1
# postfix(1) completion                                    -*- shell-script -*-
2
2
 
3
 
have postfix && {
4
 
# postfix(1)
5
 
#
6
3
_postfix()
7
4
{
8
 
    local cur prev
9
 
 
10
 
    COMPREPLY=()
11
 
    _get_comp_words_by_ref cur prev
 
5
    local cur prev words cword
 
6
    _init_completion || return
12
7
 
13
8
    case $prev in
14
9
        -c)
22
17
    esac
23
18
 
24
19
    if [[ $cur == -* ]]; then
25
 
        COMPREPLY=( $( compgen -W '-c -D -v' -- "$cur" ) )
 
20
        COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
26
21
        return 0
27
22
    fi
28
23
 
29
24
    COMPREPLY=( $( compgen -W 'check start stop abort flush reload status \
30
25
        set-permissions upgrade-configuration' -- "$cur" ) )
31
 
}
 
26
} &&
32
27
complete -F _postfix postfix
33
28
 
34
 
# postalias(1) and postmap(1)
35
 
#
36
 
_postmap()
37
 
{
38
 
    local cur prev len idx
39
 
 
40
 
    COMPREPLY=()
41
 
    _get_comp_words_by_ref cur prev
42
 
 
43
 
    case $prev in
44
 
        -c)
45
 
            _filedir -d
46
 
            return 0
47
 
            ;;
48
 
        -[dq])
49
 
            return 0
50
 
            ;;
51
 
    esac
52
 
 
53
 
    if [[ $cur == -* ]]; then
54
 
        COMPREPLY=( $( compgen -W '-N -f -i -n -o -p -r -v -w -c -d -q' \
55
 
            -- "$cur" ) )
56
 
        return 0
57
 
    fi
58
 
 
59
 
    if [[ "$cur" == *:* ]]; then
60
 
        _compopt_o_filenames
61
 
        COMPREPLY=( $( compgen -f -- "${cur#*:}" ) )
62
 
    else
63
 
        len=${#cur}
64
 
        idx=0
65
 
        for pval in $( /usr/sbin/postconf -m ); do
66
 
            if [[ "$cur" == "${pval:0:$len}" ]]; then
67
 
                COMPREPLY[$idx]="$pval:"
68
 
                idx=$(($idx+1))
69
 
            fi
70
 
        done
71
 
        if [[ $idx -eq 0 ]]; then
72
 
            _compopt_o_filenames
73
 
            COMPREPLY=( $( compgen -f -- "$cur" ) )
74
 
        fi
75
 
    fi
76
 
    return 0
77
 
}
78
 
complete -F _postmap postmap postalias
79
 
 
80
 
# postcat(1)
81
 
#
82
 
_postcat()
83
 
{
84
 
    local cur prev pval len idx qfile
85
 
 
86
 
    COMPREPLY=()
87
 
    _get_comp_words_by_ref cur prev
88
 
 
89
 
    case $prev in
90
 
        -c)
91
 
            _filedir -d
92
 
            return 0
93
 
            ;;
94
 
    esac
95
 
 
96
 
    if [[ $cur == -* ]]; then
97
 
        COMPREPLY=( $( compgen -W '-c -q -v' -- "$cur" ) )
98
 
        return 0
99
 
    fi
100
 
 
101
 
    qfile=0
102
 
    for idx in "${COMP_WORDS[@]}"; do
103
 
        [[ "$idx" = -q ]] && qfile=1 && break
104
 
    done
105
 
    if [[ $qfile == 1 ]]; then
106
 
        len=${#cur}
107
 
        idx=0
108
 
        for pval in $( mailq 2>/dev/null | \
109
 
            sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* !].*$//' ); do
110
 
            if [[ "$cur" == "${pval:0:$len}" ]]; then
111
 
                COMPREPLY[$idx]=$pval
112
 
                idx=$(($idx+1))
113
 
            fi
114
 
        done
115
 
        return 0
116
 
    else
117
 
        _filedir
118
 
        return 0
119
 
    fi
120
 
}
121
 
complete -F _postcat postcat
122
 
 
123
 
# postconf(1)
124
 
#
125
 
_postconf()
126
 
{
127
 
    local cur prev pval len idx eqext
128
 
 
129
 
    COMPREPLY=()
130
 
    _get_comp_words_by_ref cur prev
131
 
 
132
 
    case $prev in
133
 
        -b|-t)
134
 
            _filedir
135
 
            return 0
136
 
            ;;
137
 
        -c)
138
 
            _filedir -d
139
 
            return 0
140
 
            ;;
141
 
        -e)
142
 
            cur=${cur#[\"\']}
143
 
            eqext='='
144
 
            ;;
145
 
    esac
146
 
 
147
 
    if [[ $cur == -* ]]; then
148
 
        COMPREPLY=( $( compgen -W '-A -a -b -c -d -e -h -m -l -n -t -v' \
149
 
            -- "$cur" ) )
150
 
        return 0
151
 
    fi
152
 
 
153
 
    len=${#cur}
154
 
    idx=0
155
 
    for pval in $( /usr/sbin/postconf 2>/dev/null | cut -d ' ' -f 1 ); do
156
 
        if [[ "$cur" == "${pval:0:$len}" ]]; then
157
 
            COMPREPLY[$idx]="$pval$eqext"
158
 
            idx=$(($idx+1))
159
 
        fi
160
 
    done
161
 
    return 0
162
 
}
163
 
complete -F _postconf postconf
164
 
 
165
 
# postsuper(1)
166
 
#
167
 
_postsuper()
168
 
{
169
 
    local cur prev pval len idx
170
 
 
171
 
    COMPREPLY=()
172
 
    _get_comp_words_by_ref cur prev
173
 
 
174
 
    case $prev in
175
 
        -c)
176
 
            _filedir -d
177
 
            return 0
178
 
            ;;
179
 
        -[dr])
180
 
            len=${#cur}
181
 
            idx=0
182
 
            for pval in ALL $( mailq 2>/dev/null | \
183
 
                sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* !].*$//' ); do
184
 
                if [[ "$cur" == "${pval:0:$len}" ]]; then
185
 
                    COMPREPLY[$idx]=$pval
186
 
                    idx=$(($idx+1))
187
 
                fi
188
 
            done
189
 
            return 0
190
 
            ;;
191
 
        -h)
192
 
            len=${#cur}
193
 
            idx=0
194
 
            for pval in ALL $( mailq 2>/dev/null | \
195
 
                sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* ].*$//; /!$/d' ); do
196
 
                if [[ "$cur" == "${pval:0:$len}" ]]; then
197
 
                    COMPREPLY[$idx]=$pval
198
 
                    idx=$(($idx+1))
199
 
                fi
200
 
            done
201
 
            return 0
202
 
            ;;
203
 
        -H)
204
 
            len=${#cur}
205
 
            idx=0
206
 
            for pval in ALL $( mailq 2>/dev/null | \
207
 
                sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; /^[0-9A-Z]*[* ]/d; s/!.*$//' ); do
208
 
                if [[ "$cur" == "${pval:0:$len}" ]]; then
209
 
                    COMPREPLY[$idx]=$pval
210
 
                    idx=$(($idx+1))
211
 
                fi
212
 
            done
213
 
            return 0
214
 
            ;;
215
 
    esac
216
 
 
217
 
    if [[ $cur == -* ]]; then
218
 
        COMPREPLY=( $( compgen -W '-c -d -h -H -p -r -s -v' -- "$cur" ) )
219
 
        return 0
220
 
    fi
221
 
 
222
 
    COMPREPLY=( $( compgen -W 'hold incoming active deferred' -- "$cur" ) )
223
 
}
224
 
complete -F _postsuper postsuper
225
 
}
226
 
 
227
 
# Local variables:
228
 
# mode: shell-script
229
 
# sh-basic-offset: 4
230
 
# sh-indent-comment: t
231
 
# indent-tabs-mode: nil
232
 
# End:
233
29
# ex: ts=4 sw=4 et filetype=sh