open STDOUT,'| (which jq > /dev/null && jq . || cat)' if $Opt{jq};
my $Api = OvhApi->new(type => OvhApi::OVH_API_EU, applicationKey => $KEY[0], applicationSecret => $KEY[1], consumerKey => $KEY[2]);
+if ($Opt{'show-ips'}) {
+ print map {"$_\n"} ips();
+ exit;
+}
+
# Auth
auth() if @KEY < 3;
return wantarray ? @routed : \@routed;
}
-sub ips() {
- return grep { defined } map {
- /^\s*inet.*?([\d\.]+)/ and $1 ne "127.0.0.1"
+sub ips {
+ return grep { defined $_ and $_ ne ""} map {
+ /^\s*inet.*?([\d]+\.[\d]+\.[\d]+\.[\d]+)/ and $1 ne "127.0.0.1"
? $1
: undef
} `ip addr show || ifconfig`;
option[ip-routed=s] Print where is routed an ip
option[ip-is-routed=s] Exit 0 if ip is routed to this host, 2 if slave
option[sql] Produce sql to update a database
+ option[show-ips] Print local ips
option[verbose|v+] Verbose mode: increase the verbosity level.
option[debug+] Debug mode: increase the verbosity level.