Skip to content

Commit

Permalink
vpnc: Use _parse_help instead of hardcoding options, add basic test c…
Browse files Browse the repository at this point in the history
…ase.
  • Loading branch information
scop committed Feb 17, 2013
1 parent eb396b5 commit e479610
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
8 changes: 2 additions & 6 deletions completions/vpnc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions test/completion/vpnc.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
assert_source_completions vpnc
18 changes: 18 additions & 0 deletions test/lib/completions/vpnc.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
proc setup {} {
save_env
}


proc teardown {} {
assert_env_unmodified
}


setup


assert_complete_any "vpnc -"
sync_after_int


teardown

0 comments on commit e479610

Please sign in to comment.