Split ipsec completion into contrib/ipsec.

This commit is contained in:
Ville Skyttä 2010-06-09 22:50:33 +03:00
parent 3f1f6120d7
commit 887361302b
6 changed files with 74 additions and 44 deletions

View File

@ -60,6 +60,7 @@ bash-completion (2.x)
* Split chown, chgrp, and id completions into contrib/coreutils.
* Split kill, look, and renice completions into contrib/util-linux.
* Split killall, pkill, pgrep and related completions into contrib/procps.
* Split ipsec completion into contrib/ipsec.
* Do basic HTML file completion with Firefox and Chrome and friends,
and Epiphany.
* Do basic diff/patch completion with cdiff and kompare.

View File

@ -59,6 +59,7 @@ bashcomp_DATA = contrib/abook \
contrib/info \
contrib/iptables \
contrib/ipmitool \
contrib/ipsec \
contrib/ipv6calc \
contrib/isql \
contrib/jar \

View File

@ -1102,50 +1102,6 @@ _ifupdown()
complete -F _ifupdown ifup ifdown
[ $USERLAND = GNU ] && have ifstatus && complete -F _ifupdown ifstatus
# Linux ipsec(8) completion (for FreeS/WAN)
#
[ $UNAME = Linux ] && have ipsec &&
_ipsec()
{
local cur
COMPREPLY=()
cur=`_get_cword`
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W 'auto barf eroute klipsdebug look manual \
pluto ranbits rsasigkey setup showdefaults showhostkey spi spigrp \
tncfg whack' -- "$cur" ) )
return 0
fi
case ${COMP_WORDS[1]} in
auto)
COMPREPLY=( $( compgen -W '--asynchronous --up --add --delete \
--replace --down --route --unroute \
--ready --status --rereadsecrets' \
-- "$cur" ) )
;;
manual)
COMPREPLY=( $( compgen -W '--up --down --route --unroute \
--union' -- "$cur" ) )
;;
ranbits)
COMPREPLY=( $( compgen -W '--quick --continuous --bytes' \
-- "$cur" ) )
;;
setup)
COMPREPLY=( $( compgen -W '--start --stop --restart' -- "$cur" ) )
;;
*)
;;
esac
return 0
} &&
complete -F _ipsec ipsec
# This function provides simple user@host completion
#
_user_at_host() {

51
contrib/ipsec Normal file
View File

@ -0,0 +1,51 @@
# Linux ipsec(8) completion (for FreeS/WAN)
#
[ $UNAME = Linux ] && have ipsec &&
_ipsec()
{
local cur
COMPREPLY=()
cur=`_get_cword`
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W 'auto barf eroute klipsdebug look manual \
pluto ranbits rsasigkey setup showdefaults showhostkey spi spigrp \
tncfg whack' -- "$cur" ) )
return 0
fi
case ${COMP_WORDS[1]} in
auto)
COMPREPLY=( $( compgen -W '--asynchronous --up --add --delete \
--replace --down --route --unroute \
--ready --status --rereadsecrets' \
-- "$cur" ) )
;;
manual)
COMPREPLY=( $( compgen -W '--up --down --route --unroute \
--union' -- "$cur" ) )
;;
ranbits)
COMPREPLY=( $( compgen -W '--quick --continuous --bytes' \
-- "$cur" ) )
;;
setup)
COMPREPLY=( $( compgen -W '--start --stop --restart' -- "$cur" ) )
;;
*)
;;
esac
return 0
} &&
complete -F _ipsec ipsec
# Local variables:
# mode: shell-script
# sh-basic-offset: 4
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: ts=4 sw=4 et filetype=sh

View File

@ -0,0 +1 @@
assert_source_completions ipsec

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}; # setup()
proc teardown {} {
assert_env_unmodified
}; # teardown()
setup
assert_complete_any "ipsec "
sync_after_int
teardown