Skip to content

Commit

Permalink
Added -u version for check updates, Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Nhoya committed May 19, 2015
1 parent 5fcfa55 commit fb61cfb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@ This script lets you to **quickly shrink with z0r.it** any link and put the shri
*z0r -l* -> show history

*z0r -m <long_URL1> <long_URL2>* ... -> mass shorting

*z0r -r* -> reset history

*z0r -u* -> show updates

Dependencies:
wget, curl, xclip, awk
16 changes: 14 additions & 2 deletions z0r
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ readonly YELLOW="\033[00;33m"
readonly BOLD="\033[01m"
readonly FINE="\033[0m"

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

}
Expand Down Expand Up @@ -141,9 +142,17 @@ del_history(){
;;
esac
}
check_ver(){
r_ver=$(curl -s "https://api.github.com/repos/InforgeNet/z0r-script/releases" | egrep -m 1 --color 'tag_name":\s*".*"' | cut -d '"' -f 4)
if [ ! "$r_ver" = "$ver" ]; then
echo -e $GREEN"Update found"$FINE
else
echo -e $RED"No update found"$FINE
fi
}
#option parser
opsparser(){
while getopts ":hvlrde:c:m:" opt; do
while getopts ":hvulrde:c:m:" opt; do
case "$opt" in
h) help
exit 0
Expand All @@ -165,6 +174,9 @@ while getopts ":hvlrde:c:m:" opt; do
mss $@
exit 0
;;
u) check_ver
exit 0
;;
v) echo $ver
exit 0
;;
Expand Down

0 comments on commit fb61cfb

Please sign in to comment.