1
0
chezmoi/home/dot_zim/modules/jl-helper/functions/gip

24 lines
508 B
Plaintext
Raw Normal View History

2024-02-05 22:28:28 +00:00
# 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