@@ -22,18 +22,25 @@ readonly YELLOW="\033[00;33m"
2222readonly BOLD=" \033[01m"
2323readonly FINE=" \033[0m"
2424
25- ver=' 1.2 '
25+ ver=' 1.3 '
2626regex=' (https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*\.[-A-Za-z0-9\+&@#/%=~_|():?]+'
2727is_z0r=' http://z0r.it/[^ \n]'
2828url=(http://$1 )
2929mode=-s
3030dep=(curl awk xclip wget)
3131apikey=4e4b657a91
32+ LOGDIR=/$HOME /.z0r_logs
3233# upload function (long -> short)
3334shr (){
3435 short=$( curl $mode -L " http://z0r.it/yourls-api.php?signature=$apikey &action=shorturl&title=uploaded_with_z0r_script&keyword=$2 &format=simply&url=$1 " | awk -F ' /' ' {print$NF}' )
35- echo " http://z0r.it/$short "
36+ if [ -n " $short " ]; then
37+ echo " http://z0r.it/$short " && echo " $( date +" %d-%h-%Y %H.%M.%S" ) - http://z0r.it/$short - $1 " >> $LOGDIR
3638 echo " http://z0r.it/$short " | xclip -selection clipboard
39+ else
40+ if [ -n " $2 " ]; then
41+ echo -e $RED " custom URL already in use" $FINE
42+ fi
43+ fi
3744 }
3845# expand function (short -> long)
3946expand (){
@@ -54,8 +61,9 @@ help(){
5461 echo " Available Options:"
5562 echo " -e <short_URL> expand URL (short -> long)"
5663 echo " -h display this page"
57- echo " -c<short_URL> display numbers of clicks"
64+ echo " -c <short_URL> display numbers of clicks"
5865 echo " -d check dependencies"
66+ echo " -l show shorting history"
5967 echo -e $GREEN " ======================================================================================" $FINE
6068
6169 }
100108
101109# option parser
102110opsparser (){
103- while getopts " :hvde :c:" opt; do
111+ while getopts " :hvlde :c:" opt; do
104112 case " $opt " in
105113 h) help
106114 exit 0
@@ -121,6 +129,11 @@ while getopts ":hvde:c:" opt; do
121129 v) echo $ver
122130 exit 0
123131 ;;
132+ l) echo -e $GREEN " ====================================================LOGs===============================================" $FINE
133+ cat $LOGDIR
134+ echo -e $GREEN " =======================================================================================================" $FINE
135+ exit 0
136+ ;;
124137 \? ) echo -e $RED " enter a valid option, use -h for help" $FINE
125138 exit 0
126139 ;;
0 commit comments