- add completion for Postfix commands (patch by Liviu Daia <Liviu.Daia@imar.ro>
and Carsten Hoeger <choeger@suse.de>)master
parent
ab55ac1fc7
commit
7830f362dc
108
bash_completion
108
bash_completion
|
@ -1,6 +1,6 @@
|
|||
# bash_completion - some programmable completion functions for bash 2.05a
|
||||
#
|
||||
# $Id: bash_completion,v 1.301 2002/05/05 20:29:35 ianmacd Exp $
|
||||
# $Id: bash_completion,v 1.302 2002/05/05 22:46:30 ianmacd Exp $
|
||||
#
|
||||
# Copyright (C) Ian Macdonald <ian@caliban.org>
|
||||
#
|
||||
|
@ -747,6 +747,112 @@ _ipsec()
|
|||
}
|
||||
[ $UNAME = Linux ] && [ "$have" ] && complete -F _ipsec ipsec
|
||||
|
||||
# Postfix completion.
|
||||
#
|
||||
have postfix && {
|
||||
# postalias(1) and postmap(1)
|
||||
#
|
||||
_postmap()
|
||||
{
|
||||
local cur prev len idx
|
||||
|
||||
cur=${COMP_WORDS[COMP_CWORD]}
|
||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
|
||||
if [[ $cur == '-' ]]; then
|
||||
COMPREPLY=(-N -f -i -n -r -v -w -c -d -q)
|
||||
return 0
|
||||
fi
|
||||
if [[ $prev == '-c' ]]; then
|
||||
_filedir -d
|
||||
return 0
|
||||
fi
|
||||
if [[ $prev == -[dq] ]]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [[ "$cur" == *:* ]]; then
|
||||
COMPREPLY=( $( compgen -f -- ${cur#*:} ) )
|
||||
else
|
||||
len=${#cur}
|
||||
idx=0
|
||||
for pval in $( postconf -m ); do
|
||||
if [[ "$cur" == "${pval:0:$len}" ]]; then
|
||||
COMPREPLY[$idx]="$pval:"
|
||||
idx=$(($idx+1))
|
||||
fi
|
||||
done
|
||||
if [[ $idx -eq 0 ]]; then
|
||||
COMPREPLY=( $( compgen -f -- "$cur" ) )
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
complete -F _postmap postmap postalias
|
||||
|
||||
# postconf(1)
|
||||
#
|
||||
_postconf()
|
||||
{
|
||||
local cur prev len idx eqext
|
||||
|
||||
cur=${COMP_WORDS[COMP_CWORD]}
|
||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
if [[ $cur == '-' ]]; then
|
||||
COMPREPLY=(-c -d -e -h -m -l -n -v)
|
||||
return 0
|
||||
fi
|
||||
if [[ $prev == '-c' ]]; then
|
||||
_filedir -d
|
||||
return 0
|
||||
fi
|
||||
if [[ $prev == '-e' ]]; then
|
||||
cur=${cur#[\"\']}
|
||||
eqext='='
|
||||
fi
|
||||
len=${#cur}
|
||||
idx=0
|
||||
for pval in $( postconf | cut -d ' ' -f 1 ); do
|
||||
if [[ "$cur" == "${pval:0:$len}" ]]; then
|
||||
COMPREPLY[$idx]="$pval$eqext"
|
||||
idx=$(($idx+1))
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
}
|
||||
complete -F _postconf postconf
|
||||
|
||||
# postsuper(1)
|
||||
#
|
||||
_postsuper()
|
||||
{
|
||||
local cur prev len idx
|
||||
|
||||
cur=${COMP_WORDS[COMP_CWORD]}
|
||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
|
||||
if [[ $cur == '-' ]]; then
|
||||
COMPREPLY=(-d -p -r -s -v)
|
||||
return 0
|
||||
fi
|
||||
if [[ $prev == -[dr] ]]; then
|
||||
len=${#cur}
|
||||
idx=0
|
||||
for pval in $( mailq | \
|
||||
sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* ].*$//' ); do
|
||||
if [[ "$cur" == "${pval:0:$len}" ]]; then
|
||||
COMPREPLY[$idx]=$pval
|
||||
idx=$(($idx+1))
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
fi
|
||||
_filedir -d
|
||||
return 0
|
||||
}
|
||||
complete -F _postsuper postsuper
|
||||
}
|
||||
|
||||
# cvs(1) completion
|
||||
#
|
||||
have cvs && {
|
||||
|
|
Loading…
Reference in New Issue