elvish_config/aliases/ipinfo.elv

20 lines
344 B
Plaintext
Raw Normal View History

2021-08-24 18:45:25 +00:00
edit:add-var ipinfo~ [@argv]{
use moi/util/ip
use str
var token = (cat $E:HOME/.config/elvish/private/ipinfo_token)
2021-08-24 18:45:25 +00:00
fn url-of [ip]{
str:join '' [ 'ipinfo.io/' $ip '?token=' $token]
}
fn info [ip]{
if (ip:is-ip $ip) {
var url = (url-of $ip)
2021-08-24 18:45:25 +00:00
echo 'URL: '$url
e:curlie $url
}
}
each $info~ $argv
}