dotfiles/conf.d/zim/modules/jl-helper/functions/gip

24 lines
508 B
Plaintext
Raw Normal View History

2021-02-19 20:34:24 +00:00
# vim:et sts=2 sw=2 ft=zsh
#
2024-01-05 17:03:57 +00:00
# Display public ip information
2021-02-19 20:34:24 +00:00
#
2024-01-05 17:03:57 +00:00
URL="ipinfo.io?token=$(pass _api_keys/ipinfo_perso-0)"
2021-02-19 20:34:24 +00:00
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