vpnc: Use _parse_help instead of hardcoding options, add basic test case.

This commit is contained in:
Ville Skyttä 2013-02-17 22:16:12 +02:00
parent eb396b58a7
commit e4796104bc
3 changed files with 21 additions and 6 deletions

View File

@ -25,12 +25,8 @@ _vpnc()
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--version --print-config --help \
--long-help --gateway --id --username --udp --domain \
--xauth-inter --script --dh --pfs --enable-1des \
--application-version --ifname --debug --no-detach \
--pid-file --local-port --udp-port --disable-natt \
--non-inter' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" --long-help )' \
-- "$cur" ) )
else
COMPREPLY=( $( compgen -W '$( command ls /etc/vpnc )' -- "$cur" ) )
fi

1
test/completion/vpnc.exp Normal file
View File

@ -0,0 +1 @@
assert_source_completions vpnc

View File

@ -0,0 +1,18 @@
proc setup {} {
save_env
}
proc teardown {} {
assert_env_unmodified
}
setup
assert_complete_any "vpnc -"
sync_after_int
teardown