From fb61cfbe7faa2e4ba63b504511d1648d0f5426b4 Mon Sep 17 00:00:00 2001 From: Nhoya Date: Tue, 19 May 2015 15:10:30 +0200 Subject: [PATCH] Added -u version for check updates, Update README.md --- README.md | 7 +++++++ z0r | 16 ++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 559c5f7..4118c65 100644 --- a/README.md +++ b/README.md @@ -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 * ... -> mass shorting + +*z0r -r* -> reset history + +*z0r -u* -> show updates + +Dependencies: +wget, curl, xclip, awk diff --git a/z0r b/z0r index f62adf3..2dbcb5d 100644 --- a/z0r +++ b/z0r @@ -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) @@ -72,6 +72,7 @@ help(){ echo " -l show shorting history" echo " -m ... mass shorting" echo " -r reset history" + echo " -u show updates" echo -e $GREEN"======================================================================================"$FINE } @@ -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 @@ -165,6 +174,9 @@ while getopts ":hvlrde:c:m:" opt; do mss $@ exit 0 ;; + u) check_ver + exit 0 + ;; v) echo $ver exit 0 ;;