From 64059155774e2b35bbff97442e409ec5f0203256 Mon Sep 17 00:00:00 2001 From: Steven Schubiger Date: Sun, 15 Sep 2013 16:16:39 +0200 Subject: List remote entries --- client.pl | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'client.pl') diff --git a/client.pl b/client.pl index 9992c9d..e573f9d 100755 --- a/client.pl +++ b/client.pl @@ -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)}; -- cgit v1.2.3