elvish_config/aliases/ipinfo.elv

19 lines
368 B
Plaintext

edit:add-var ipinfo~ {|@argv|
use framagit.org/benjamin.vaudour/elv-lib/mods/ip
var token = (cat $E:HOME/.config/elvish/private/ipinfo_token)
fn url-of {|ip|
printf 'ipinfo.io/%s?token=%s' $ip $token
}
fn info {|ip|
if (ip:is-ip $ip) {
var url = (url-of $ip)
printf "URL: %s\n" $url
e:curlie $url
}
}
each $info~ $argv
}