Skip to content

Commit c986988

Browse files
committed
Fuzzy search vpn list and connect
1 parent 92d2928 commit c986988

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lazy-connect.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,15 @@ EOF
6464
}
6565

6666
function lazy-connect() {
67-
while getopts "iah" opt; do
67+
while getopts "ih" opt; do
6868
case $opt in
6969
h)
7070
echo "Usage"
71+
return 0
7172
;;
7273
i)
7374
_lazy_connect_init
74-
;;
75-
a)
76-
echo "Connect all"
75+
return 0
7776
;;
7877
\?)
7978
echo "Invalid Option: -$OPTARG."
@@ -87,4 +86,10 @@ function lazy-connect() {
8786
;;
8887
esac
8988
done
89+
90+
config_dir=~/.config/lazy-connect
91+
secret=$(cat $config_dir/secret)
92+
vpn_name=$(cat $config_dir/vpns \
93+
| fzf --height=10 --ansi --reverse)
94+
[ -z "$vpn_name" ] || _lazy_connect $vpn_name $secret
9095
}

0 commit comments

Comments
 (0)