summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Skyttä <ville.skytta@iki.fi>2013-02-17 22:16:12 +0200
committerVille Skyttä <ville.skytta@iki.fi>2013-02-17 22:16:35 +0200
commite4796104bc81247bceb591164b227b3cd762c46f (patch)
tree7d440103167d0b067c56ceac7542bdd826b086df
parenteb396b58a709201e61daf2e381abecb411863b2a (diff)
downloadbash-completion-e4796104bc81247bceb591164b227b3cd762c46f.tar.gz
vpnc: Use _parse_help instead of hardcoding options, add basic test case.
-rw-r--r--completions/vpnc8
-rw-r--r--test/completion/vpnc.exp1
-rw-r--r--test/lib/completions/vpnc.exp18
3 files changed, 21 insertions, 6 deletions
diff --git a/completions/vpnc b/completions/vpnc
index 0465c31e..115aeb7a 100644
--- a/completions/vpnc
+++ b/completions/vpnc
@@ -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
diff --git a/test/completion/vpnc.exp b/test/completion/vpnc.exp
new file mode 100644
index 00000000..29511b59
--- /dev/null
+++ b/test/completion/vpnc.exp
@@ -0,0 +1 @@
+assert_source_completions vpnc
diff --git a/test/lib/completions/vpnc.exp b/test/lib/completions/vpnc.exp
new file mode 100644
index 00000000..451d8093
--- /dev/null
+++ b/test/lib/completions/vpnc.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "vpnc -"
+sync_after_int
+
+
+teardown