1. changed help command so that it works correctly with multiple title lines.
[spider.git] / cmd / help.pl
index afdd2d302df66cc0d14db4c1dba93ba20b3eaf0d..cf3dbd8b5a9e25a65f7e81c04bd596e060df8355 100644 (file)
@@ -50,21 +50,24 @@ $line =~ s/\s+$//og;
 my $alias = CmdAlias::get_hlp($line);
 $line = $alias if $alias;
 
-my $include;
+my $state = 0;
 foreach $in (<$h>) {
        next if $in =~ /^\#/;
        chomp $in;
        if ($in =~ /^===/) {
-               $include = 0;
+           last if $state == 2;           # come out on next command
                $in =~ s/=== //;
                my ($priv, $cmd, $desc) = split /\^/, $in;
                next if $priv > $self->priv;             # ignore subcommands that are of no concern
                next unless $cmd =~ /$line/i;
                push @out, "$cmd $desc" unless $cmd =~ /-$/o;
-               $include = 1;
+               $state = 1;
                next;
        }
-       push @out, "   $in" if $include;
+       if ($state > 0) {
+           push @out, " $in";
+               $state = 2;
+       }
 }
 
 close($h);