Add help for sh/band and improve sh/band command
authorDirk Koopman <djk@tobit.co.uk>
Thu, 12 Jul 2007 16:20:49 +0000 (17:20 +0100)
committerDirk Koopman <djk@tobit.co.uk>
Thu, 12 Jul 2007 16:20:49 +0000 (17:20 +0100)
Allow sh/bands to have arguments so people can query
a band or region.

Changes
cmd/Commands_en.hlp
cmd/show/bands.pl
perl/Version.pm

diff --git a/Changes b/Changes
index d1d688c8e211a4adafb84f44dc0bc35f487e7dc7..f03ffc3e25dc5707473bc3dc10acc23fc1c6d7b7 100644 (file)
--- 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
index 659d6758d659a60dd4d149368515a260ca516d62..74520ea39795deb005c238d245058fd97ea4d776 100644 (file)
@@ -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.
 
index 9bdd5dc6585fc4ea6274fd4b1cc6661248ec15d3..67b0cb5e0b7dd9021e0c3b6095b33d401c0e74dd 100644 (file)
@@ -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;
        }
 }
index 280eb1d1c84afb93912cab99ac3f125c3b41173e..141b473a942f32a9fb9488dd264ec61cac5b6376 100644 (file)
@@ -11,6 +11,6 @@ use vars qw($version $subversion $build);
 
 $version = '1.54';
 $subversion = '0';
-$build = '116';
+$build = '117';
 
 1;