2021-08-24 18:45:25 +00:00
|
|
|
edit:add-var ipinfo~ [@argv]{
|
|
|
|
use moi/util/ip
|
|
|
|
use str
|
|
|
|
|
2021-08-27 19:45:39 +00:00
|
|
|
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) {
|
2021-08-27 19:45:39 +00:00
|
|
|
var url = (url-of $ip)
|
2021-08-24 18:45:25 +00:00
|
|
|
echo 'URL: '$url
|
|
|
|
e:curlie $url
|
|
|
|
}
|
|
|
|
}
|
|
|
|
each $info~ $argv
|
|
|
|
}
|