/ip support

This commit is contained in:
Jack L. Frost 2015-10-12 17:59:33 +03:00
parent b118e40f72
commit e3d642a730
1 changed files with 11 additions and 0 deletions

11
sup
View File

@ -167,6 +167,14 @@ sup.mktemp() {
printf '%s\n' "${tmp_dir}/${tmp_file_name}"
}
sup.get_my_ip() {
my_ip=$( curl -fsL https://zfh.so/ip )
if ! (( $? )); then
printf '%s\n' $my_ip
fi
}
sup.set_argv() {
declare arg opt c
declare -g argv
@ -219,6 +227,8 @@ main() {
flag_scrot_fullscreen='1'
;;
-i|--my-ip) action='getmyip';;
-S|--short) flag_shortlink='1';;
-u|--url) action='url';;
@ -236,6 +246,7 @@ main() {
case "${action:-upload}" in
upload) sup.upload "$1";;
url) sup.url "$1";;
getmyip) sup.get_my_ip;;
esac
}