elvish_config/aliases/ipinfo.elv

20 lines
344 B
Plaintext

edit:add-var ipinfo~ {|@argv|
use moi/util/ip
use str
var 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) {
var url = (url-of $ip)
echo 'URL: '$url
e:curlie $url
}
}
each $info~ $argv
}