diff options
author | Steven Schubiger <stsc@refcnt.org> | 2013-09-15 16:16:39 +0200 |
---|---|---|
committer | Steven Schubiger <stsc@refcnt.org> | 2013-09-15 16:16:39 +0200 |
commit | 64059155774e2b35bbff97442e409ec5f0203256 (patch) | |
tree | e714d41b8c409cb841bbe6c5f9288829cbc58266 /client.pl | |
parent | 577cd6cddb2b1d6bfa21d682308fde6493d9dab6 (diff) | |
download | distdns-64059155774e2b35bbff97442e409ec5f0203256.tar.gz distdns-64059155774e2b35bbff97442e409ec5f0203256.tar.bz2 |
List remote entries
Diffstat (limited to 'client.pl')
-rwxr-xr-x | client.pl | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -45,12 +45,13 @@ Usage: $0 -d, --debug server debugging -h, --help this help screen -i, --init initialize session data + -l, --list list remote entries USAGE exit; } my %opts; -GetOptions(\%opts, qw(d|debug h|help i|init)) or usage(); +GetOptions(\%opts, qw(d|debug h|help i|init l|list)) or usage(); usage() if $opts{h}; my $config = Config::Tiny->new; @@ -104,6 +105,7 @@ my %params = ( name => $name, debug => $opts{d} || false, init => $opts{i} || false, + list => $opts{l} || false, session => $session, ); @@ -122,6 +124,21 @@ if ($response->is_success) { $save_session->($session) if $opts{i}; + if ($opts{l}) { + format STDOUT_TOP = +IP Name PC Netz +============================================================================= +. + foreach my $entry (sort { $a->{netz} cmp $b->{netz} } @{$data->{entries}}) { + format STDOUT = +@<<<<<<<<<<<<<< @<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<< +@$entry{qw(ip name pc netz)} +. + write; + } + exit; + } + my %list; foreach my $entry (@{$data->{entries}}) { my $host = "$entry->{ip}\t" . join '.', @$entry{qw(name pc netz)}; |