20 lines
348 B
Plaintext
20 lines
348 B
Plaintext
|
edit:add-var ipinfo~ [@argv]{
|
||
|
use moi/util/ip
|
||
|
use str
|
||
|
|
||
|
local:token = (cat $E:HOME/.config/elvish/private/ipinfo_token)
|
||
|
|
||
|
fn url-of [ip]{
|
||
|
str:join '' [ 'ipinfo.io/' $ip '?token=' $token]
|
||
|
}
|
||
|
|
||
|
fn info [ip]{
|
||
|
if (ip:is-ip $ip) {
|
||
|
local:url = (url-of $ip)
|
||
|
echo 'URL: '$url
|
||
|
e:curlie $url
|
||
|
}
|
||
|
}
|
||
|
each $info~ $argv
|
||
|
}
|