From: Nicolas Boisselier Date: Sat, 4 Feb 2017 22:31:54 +0000 (+0000) Subject: bin/ovh-api X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=8927e9bc0139990969442245f6445690887cea5f;p=nb.git bin/ovh-api --- diff --git a/bin/ovh-api b/bin/ovh-api index 85a992be..febf94bb 100755 --- a/bin/ovh-api +++ b/bin/ovh-api @@ -115,13 +115,21 @@ sub query { return unless defined $content; if ($Opt{rows}) { + print "[\n" if @$content>0; + my $count = 0; for my $id (@$content) { - $id =~ s,/.*$,,; next if $URL eq '/ip' and $id !~ /\d+\./; + + $id =~ s,/.*$,,; $response = $Api->rawCall(path=>$URL.'/'.$id,method=>$Opt{method},body=>{}); die "$NAME: ERR: ".$response->error()."\n" if $response->isFailure(); + + + print ',' if $count > 0; print JSON::encode_json($response->content)."\n"; + $count++; } + print "]\n" if $count>0; return }