From ba5625a459d1418cdc05591ae556df58d509ac9d Mon Sep 17 00:00:00 2001 From: Dirk Koopman Date: Thu, 12 Jul 2007 17:20:49 +0100 Subject: [PATCH] Add help for sh/band and improve sh/band command Allow sh/bands to have arguments so people can query a band or region. --- Changes | 1 + cmd/Commands_en.hlp | 8 ++++++++ cmd/show/bands.pl | 35 ++++++++++++++++++++++------------- perl/Version.pm | 2 +- 4 files changed, 32 insertions(+), 14 deletions(-) diff --git a/Changes b/Changes index d1d688c8..f03ffc3e 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,7 @@ 12Jul07======================================================================= 1. Change disconnection code so that nodes that are no longer routable are (all) cleared out. +2. Add help for sh/band and also allow query of individual band or regions. 11Jul07======================================================================= 1. improve speed of sh/c/n 2. remove all $Id$ strings from cmd tree diff --git a/cmd/Commands_en.hlp b/cmd/Commands_en.hlp index 659d6758..74520ea3 100644 --- a/cmd/Commands_en.hlp +++ b/cmd/Commands_en.hlp @@ -1855,6 +1855,14 @@ for more information. Display all the bad words in the system, see SET/BADWORD for more information. +=== 0^SHOW/BANDS [band|region names]^Show the list of bands and regions +Display the bands and regions (collections of bands) known to +the system. If you supply band or region names to SHOW/BANDS, +the command will display just those bands or regions, e.g.: + + sh/band + sh/band 2m hf + === 0^SHOW/BUDDY^Show your list of buddies See SET/BUDDY for more information about buddies. diff --git a/cmd/show/bands.pl b/cmd/show/bands.pl index 9bdd5dc6..67b0cb5e 100644 --- a/cmd/show/bands.pl +++ b/cmd/show/bands.pl @@ -6,34 +6,43 @@ # # -#$DB::single = 1; +$DB::single = 1; my ($self, $line) = @_; my @f = split /\s+/, $line; -my @bands; +my @bands = grep {Bands::get($_)?$_:()} @f; +my @regs = grep {Bands::get_region($_)?$_:()} @f; my $band; my @out; my $i; -if (!$line) { - @bands = sort { Bands::get($a)->band->[0] <=> Bands::get($b)->band->[0] } Bands::get_keys(); +unless (@f) { + @bands = Bands::get_keys(); + @regs = Bands::get_region_keys(); +} +if (@bands) { + @bands = sort { Bands::get($a)->band->[0] <=> Bands::get($b)->band->[0] } @bands; push @out, "Bands Available:-"; - foreach $band (@bands) { - my $ref = Bands::get($band)->band; - my $s = sprintf "%10s: ", $band; - for ($i = 0; $i < $#{$ref}; $i += 2) { + foreach my $name (@bands) { + my $band = Bands::get($name); + my $ref = $band->band; + my $s = sprintf "%10s: ", $name; + for ($i = 0; $i < @$ref; $i += 2) { my $from = $ref->[$i]; my $to = $ref->[$i+1]; $s .= ", " if $i; $s .= "$from -> $to"; } push @out, $s; - } + } +} + +if (@regs) { push @out, "Regions Available:-"; - @bands = Bands::get_region_keys(); - foreach $band (@bands) { - my $ref = Bands::get_region($band); - my $s = sprintf("%10s: ", $band ) . join(' ', @{$ref}); + @regs = sort @regs; + foreach my $region (@regs) { + my $ref = Bands::get_region($region); + my $s = sprintf("%10s: ", $region ) . join(' ', @{$ref}); push @out, $s; } } diff --git a/perl/Version.pm b/perl/Version.pm index 280eb1d1..141b473a 100644 --- a/perl/Version.pm +++ b/perl/Version.pm @@ -11,6 +11,6 @@ use vars qw($version $subversion $build); $version = '1.54'; $subversion = '0'; -$build = '116'; +$build = '117'; 1; -- 2.43.0