summaryrefslogtreecommitdiffstats
path: root/client.pl
diff options
context:
space:
mode:
Diffstat (limited to 'client.pl')
-rwxr-xr-xclient.pl19
1 files changed, 18 insertions, 1 deletions
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)};