X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fshow%2Fbands.pl;h=67b0cb5e0b7dd9021e0c3b6095b33d401c0e74dd;hb=ba5625a459d1418cdc05591ae556df58d509ac9d;hp=9bdd5dc6585fc4ea6274fd4b1cc6661248ec15d3;hpb=fb9c2ab04977b4e685b0eca3b2a2d04a77f65f4b;p=spider.git 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; } }