File tree Expand file tree Collapse file tree 1 file changed +10
-20
lines changed Expand file tree Collapse file tree 1 file changed +10
-20
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ lazy-connect - Shell function to fuzzy search an IPSec VPN by name
43
43
44
44
-i - Initialize lazy-connect.
45
45
Stores the secret and VPN list to ~/.config/lazy-connect/
46
+ -u - Update lazy-connect
46
47
-h - Show this help
47
48
EOF
48
49
}
78
79
79
80
function _lazy_connect_update() {
80
81
lazy_connect_dir=~ /.lazy-connect
81
- seconds_in_7_days=$( echo $(( (7 * 24 ) * 3600 )) )
82
- commit_epoch=$( git -C $lazy_connect_dir log -1 --format=%cd --date=format:" %s" )
83
- now_epoch=$( date " +%s" )
84
- diff=$( echo $(( $now_epoch - $commit_epoch )) )
85
- if [ $diff -ge $seconds_in_7_days ]; then
86
- echo -n " Do you want to update lazy-connect?(y/n) "
87
- read input
88
- case $input in
89
- Y|y)
90
- echo " Updating..."
91
- git -C $lazy_connect_dir pull origin master
92
- ;;
93
- * )
94
- echo " Skipping update"
95
- ;;
96
- esac
97
- fi
82
+ git -C $lazy_connect_dir pull origin master
83
+ echo -e " \n\nRun the below command or restart your shell."
84
+ echo " $ source $lazy_connect_dir /lazy-connect.sh"
98
85
}
99
86
100
87
function lazy-connect() {
88
+ local OPTIND
101
89
config_dir=~ /.config/lazy-connect
102
90
mkdir -p $config_dir
103
91
104
- _lazy_connect_update
105
-
106
- while getopts " ih" opt; do
92
+ while getopts " ihu" opt; do
107
93
case $opt in
108
94
h)
109
95
_lazy_connect_usage
@@ -113,6 +99,10 @@ function lazy-connect() {
113
99
_lazy_connect_init
114
100
return 0
115
101
;;
102
+ u)
103
+ _lazy_connect_update
104
+ return 0
105
+ ;;
116
106
\? )
117
107
echo " Invalid Option: -$OPTARG ."
118
108
_lazy_connect_usage
You can’t perform that action at this time.
0 commit comments