24 lines
508 B
Bash
24 lines
508 B
Bash
# vim:et sts=2 sw=2 ft=zsh
|
|
#
|
|
# Display public ip information
|
|
#
|
|
|
|
URL="ipinfo.io?token=$(pass _api_keys/ipinfo_perso-0)"
|
|
|
|
case "${1}" in
|
|
(-a)
|
|
curl --silent -L ${URL} > /dev/null | jq ;;
|
|
(-c)
|
|
curl --silent -L ${URL} > /dev/null | jq '.city';;
|
|
(-C)
|
|
curl --silent -L ${URL} > /dev/null | jq '.country';;
|
|
(-i)
|
|
curl --silent -L ${URL} > /dev/null | jq '.ip';;
|
|
(-r)
|
|
curl --silent -L ${URL} > /dev/null | jq '.region';;
|
|
(*)
|
|
curl --silent -L ${URL} > /dev/null | jq ;;
|
|
esac
|
|
|
|
compdef _files gip
|