Browse Source

Add a reconnect command

Signed-off-by: Gavin Howard <gavin@yzena.com>
master
Gavin Howard 6 months ago
parent
commit
d2d285003b
Signed by: gavin GPG Key ID: C08038BDF280D33E
  1. 2
      vpn_completions.sh
  2. 3
      vpnctl.sh

2
vpn_completions.sh

@ -8,7 +8,7 @@ _vpn_completions()
fi
if [ "${COMP_CWORD}" -eq 1 ]; then
COMPREPLY=($(compgen -W "connect disconnect switch" "${COMP_WORDS[1]}"))
COMPREPLY=($(compgen -W "connect disconnect switch reconnect" "${COMP_WORDS[1]}"))
elif [ "${COMP_CWORD}" -eq 2 ]; then
local files=$(ls $HOME/.config/expressvpn/${COMP_WORDS[2]}*.ovpn 2> /dev/null)

3
vpnctl.sh

@ -7,7 +7,7 @@
if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then
printf 'usage: %s <command> [<connection_name>]\n' "$0"
printf ' valid commands are: connect, disconnect, switch\n'
printf ' valid commands are: connect, disconnect, reconnect, switch\n'
exit 1
fi
@ -28,6 +28,7 @@ disconnect=0
case "$cmd" in
connect) connect=1 ;;
disconnect) disconnect=1 ;;
reconnect) connect=1; disconnect=1 ;;
switch) connect=1; disconnect=1 ;;
*) printf 'Invalid command: %s\n' "$cmd"; exit 2 ;;
esac

Loading…
Cancel
Save