/ip support

This commit is contained in:
Jack L. Frost 2015-10-12 17:59:33 +03:00
parent b118e40f72
commit e3d642a730

11
sup
View File

@ -167,6 +167,14 @@ sup.mktemp() {
printf '%s\n' "${tmp_dir}/${tmp_file_name}" 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() { sup.set_argv() {
declare arg opt c declare arg opt c
declare -g argv declare -g argv
@ -219,6 +227,8 @@ main() {
flag_scrot_fullscreen='1' flag_scrot_fullscreen='1'
;; ;;
-i|--my-ip) action='getmyip';;
-S|--short) flag_shortlink='1';; -S|--short) flag_shortlink='1';;
-u|--url) action='url';; -u|--url) action='url';;
@ -236,6 +246,7 @@ main() {
case "${action:-upload}" in case "${action:-upload}" in
upload) sup.upload "$1";; upload) sup.upload "$1";;
url) sup.url "$1";; url) sup.url "$1";;
getmyip) sup.get_my_ip;;
esac esac
} }