Various postfix completion improvements.
This commit is contained in:
parent
29c9fc3df8
commit
cc66ec76f5
1
CHANGES
1
CHANGES
@ -49,6 +49,7 @@ bash-completion (1.x)
|
||||
* Fix leaking $prev from cpio, dsniff, freeciv, gkrellm, mkinitrd, and
|
||||
tcpdump completions.
|
||||
* Split ant completion to contrib/ant, improve the built in one.
|
||||
* Improve postfix completion.
|
||||
|
||||
[ Todd Zullinger ]
|
||||
* Make yum complete on filenames after install, deplist, update and upgrade
|
||||
|
117
contrib/postfix
117
contrib/postfix
@ -10,25 +10,30 @@ _postfix()
|
||||
{
|
||||
local cur prev
|
||||
|
||||
COMPREPLY=()
|
||||
cur=`_get_cword`
|
||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
|
||||
if [[ $cur == '-' ]]; then
|
||||
COMPREPLY=(-c -D -v)
|
||||
return 0
|
||||
fi
|
||||
if [[ $prev == '-c' ]]; then
|
||||
case $prev in
|
||||
-c)
|
||||
_filedir -d
|
||||
return 0
|
||||
fi
|
||||
if [[ $prev == '-D' ]]; then
|
||||
COMPREPLY=( $( compgen -W 'start' -- "`_get_cword`" ) )
|
||||
;;
|
||||
-D)
|
||||
COMPREPLY=( $( compgen -W 'start' -- $cur ) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ $cur == -* ]]; then
|
||||
COMPREPLY=( $( compgen -W '-c -D -v' -- $cur ) )
|
||||
return 0
|
||||
fi
|
||||
COMPREPLY=( $( compgen -W 'start stop reload abort flush check' -- \
|
||||
"`_get_cword`" ) )
|
||||
|
||||
COMPREPLY=( $( compgen -W 'check start stop abort flush reload status \
|
||||
set-permissions upgrade-configuration' -- $cur ) )
|
||||
}
|
||||
complete -F _postfix postfix
|
||||
complete -F _postfix $filenames postfix
|
||||
|
||||
# postalias(1) and postmap(1)
|
||||
#
|
||||
@ -36,18 +41,23 @@ _postmap()
|
||||
{
|
||||
local cur prev len idx
|
||||
|
||||
COMPREPLY=()
|
||||
cur=`_get_cword`
|
||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
|
||||
if [[ $cur == '-' ]]; then
|
||||
COMPREPLY=(-N -f -i -n -o -p -r -v -w -c -d -q)
|
||||
return 0
|
||||
fi
|
||||
if [[ $prev == '-c' ]]; then
|
||||
case $prev in
|
||||
-c)
|
||||
_filedir -d
|
||||
return 0
|
||||
fi
|
||||
if [[ $prev == -[dq] ]]; then
|
||||
;;
|
||||
-[dq])
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ $cur == -* ]]; then
|
||||
COMPREPLY=( $( compgen -W '-N -f -i -n -o -p -r -v -w -c -d -q'\
|
||||
-- $cur ) )
|
||||
return 0
|
||||
fi
|
||||
|
||||
@ -68,7 +78,7 @@ _postmap()
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
complete -F _postmap postmap postalias
|
||||
complete -F _postmap $filenames postmap postalias
|
||||
|
||||
# postcat(1)
|
||||
#
|
||||
@ -76,16 +86,20 @@ _postcat()
|
||||
{
|
||||
local cur prev pval len idx qfile
|
||||
|
||||
COMPREPLY=()
|
||||
cur=`_get_cword`
|
||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
|
||||
if [[ $cur == '-' ]]; then
|
||||
COMPREPLY=(-c -q -v)
|
||||
return 0
|
||||
fi
|
||||
if [[ $prev == '-c' ]]; then
|
||||
case $prev in
|
||||
-c)
|
||||
_filedir -d
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ $cur == -* ]]; then
|
||||
COMPREPLY=( $( compgen -W '-c -q -v' -- $cur ) )
|
||||
return 0
|
||||
fi
|
||||
|
||||
qfile=0
|
||||
@ -95,7 +109,7 @@ _postcat()
|
||||
if [[ $qfile == 1 ]]; then
|
||||
len=${#cur}
|
||||
idx=0
|
||||
for pval in $( mailq | \
|
||||
for pval in $( mailq 2>/dev/null | \
|
||||
sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* !].*$//' ); do
|
||||
if [[ "$cur" == "${pval:0:$len}" ]]; then
|
||||
COMPREPLY[$idx]=$pval
|
||||
@ -108,7 +122,7 @@ _postcat()
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
complete -F _postcat postcat
|
||||
complete -F _postcat $filenames postcat
|
||||
|
||||
# postconf(1)
|
||||
#
|
||||
@ -116,23 +130,34 @@ _postconf()
|
||||
{
|
||||
local cur prev pval len idx eqext
|
||||
|
||||
COMPREPLY=()
|
||||
cur=`_get_cword`
|
||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
if [[ $cur == '-' ]]; then
|
||||
COMPREPLY=(-c -d -e -h -m -l -n -v)
|
||||
|
||||
case $prev in
|
||||
-b|-t)
|
||||
_filedir
|
||||
return 0
|
||||
fi
|
||||
if [[ $prev == '-c' ]]; then
|
||||
;;
|
||||
-c)
|
||||
_filedir -d
|
||||
return 0
|
||||
fi
|
||||
if [[ $prev == '-e' ]]; then
|
||||
;;
|
||||
-e)
|
||||
cur=${cur#[\"\']}
|
||||
eqext='='
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ $cur == -* ]]; then
|
||||
COMPREPLY=( $( compgen -W '-A -a -b -c -d -e -h -m -l -n -t -v'\
|
||||
-- $cur ) )
|
||||
return 0
|
||||
fi
|
||||
|
||||
len=${#cur}
|
||||
idx=0
|
||||
for pval in $( /usr/sbin/postconf | cut -d ' ' -f 1 ); do
|
||||
for pval in $( /usr/sbin/postconf 2>/dev/null | cut -d ' ' -f 1 ); do
|
||||
if [[ "$cur" == "${pval:0:$len}" ]]; then
|
||||
COMPREPLY[$idx]="$pval$eqext"
|
||||
idx=$(($idx+1))
|
||||
@ -140,7 +165,7 @@ _postconf()
|
||||
done
|
||||
return 0
|
||||
}
|
||||
complete -F _postconf postconf
|
||||
complete -F _postconf $filenames postconf
|
||||
|
||||
# postsuper(1)
|
||||
#
|
||||
@ -148,18 +173,19 @@ _postsuper()
|
||||
{
|
||||
local cur prev pval len idx
|
||||
|
||||
COMPREPLY=()
|
||||
cur=`_get_cword`
|
||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
|
||||
if [[ $cur == '-' ]]; then
|
||||
COMPREPLY=(-c -d -h -H -p -r -s -v)
|
||||
return 0
|
||||
fi
|
||||
case $prev in
|
||||
-c)
|
||||
_filedir -d
|
||||
return 0
|
||||
;;
|
||||
-[dr])
|
||||
len=${#cur}
|
||||
idx=0
|
||||
for pval in $( echo ALL; mailq | \
|
||||
for pval in $( echo ALL; mailq 2>/dev/null | \
|
||||
sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* !].*$//' ); do
|
||||
if [[ "$cur" == "${pval:0:$len}" ]]; then
|
||||
COMPREPLY[$idx]=$pval
|
||||
@ -171,7 +197,7 @@ _postsuper()
|
||||
-h)
|
||||
len=${#cur}
|
||||
idx=0
|
||||
for pval in $( echo ALL; mailq | \
|
||||
for pval in $( echo ALL; mailq 2>/dev/null | \
|
||||
sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* ].*$//; /!$/d' ); do
|
||||
if [[ "$cur" == "${pval:0:$len}" ]]; then
|
||||
COMPREPLY[$idx]=$pval
|
||||
@ -183,7 +209,7 @@ _postsuper()
|
||||
-H)
|
||||
len=${#cur}
|
||||
idx=0
|
||||
for pval in $( echo ALL; mailq | \
|
||||
for pval in $( echo ALL; mailq 2>/dev/null | \
|
||||
sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; /^[0-9A-Z]*[* ]/d; s/!.*$//' ); do
|
||||
if [[ "$cur" == "${pval:0:$len}" ]]; then
|
||||
COMPREPLY[$idx]=$pval
|
||||
@ -193,8 +219,13 @@ _postsuper()
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
COMPREPLY=( $( compgen -W 'hold incoming active deferred' -- $cur ) )
|
||||
|
||||
if [[ $cur == -* ]]; then
|
||||
COMPREPLY=( $( compgen -W '-c -d -h -H -p -r -s -v' -- $cur ) )
|
||||
return 0
|
||||
fi
|
||||
|
||||
COMPREPLY=( $( compgen -W 'hold incoming active deferred' -- $cur ) )
|
||||
}
|
||||
complete -F _postsuper postsuper
|
||||
complete -F _postsuper $filenames postsuper
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user