Skip to content

Commit fb61cfb

Browse files
author
Nhoya
committed
Added -u version for check updates, Update README.md
1 parent 5fcfa55 commit fb61cfb

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,10 @@ This script lets you to **quickly shrink with z0r.it** any link and put the shri
2323
*z0r -l* -> show history
2424

2525
*z0r -m <long_URL1> <long_URL2>* ... -> mass shorting
26+
27+
*z0r -r* -> reset history
28+
29+
*z0r -u* -> show updates
30+
31+
Dependencies:
32+
wget, curl, xclip, awk

z0r

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ readonly YELLOW="\033[00;33m"
2222
readonly BOLD="\033[01m"
2323
readonly FINE="\033[0m"
2424

25-
ver='1.5'
25+
ver='v1.6'
2626
regex='(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*\.[A-Za-z0-9\+&@%#/=~_|():?]+'
2727
is_z0r='http://z0r.it/[^ \n]'
2828
url=(http://$1)
@@ -72,6 +72,7 @@ help(){
7272
echo " -l show shorting history"
7373
echo " -m <long_URL1> <long_URL2> ... mass shorting"
7474
echo " -r reset history"
75+
echo " -u show updates"
7576
echo -e $GREEN"======================================================================================"$FINE
7677

7778
}
@@ -141,9 +142,17 @@ del_history(){
141142
;;
142143
esac
143144
}
145+
check_ver(){
146+
r_ver=$(curl -s "https://api.github.com/repos/InforgeNet/z0r-script/releases" | egrep -m 1 --color 'tag_name":\s*".*"' | cut -d '"' -f 4)
147+
if [ ! "$r_ver" = "$ver" ]; then
148+
echo -e $GREEN"Update found"$FINE
149+
else
150+
echo -e $RED"No update found"$FINE
151+
fi
152+
}
144153
#option parser
145154
opsparser(){
146-
while getopts ":hvlrde:c:m:" opt; do
155+
while getopts ":hvulrde:c:m:" opt; do
147156
case "$opt" in
148157
h) help
149158
exit 0
@@ -165,6 +174,9 @@ while getopts ":hvlrde:c:m:" opt; do
165174
mss $@
166175
exit 0
167176
;;
177+
u) check_ver
178+
exit 0
179+
;;
168180
v) echo $ver
169181
exit 0
170182
;;

0 commit comments

Comments
 (0)