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

24 lines
491 B
Plaintext
Raw Normal View History

2021-02-19 20:34:24 +00:00
# vim:et sts=2 sw=2 ft=zsh
#
# Display public ip information
#
URL="ipinfo.io?token=2a605445c3e4fe"
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