X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fhelp.pl;h=d87de98113d6fc84829dd08619cedbd592dc307e;hb=9e6f8da122e48430e5b56b27cf7d06c688cb2e13;hp=afdd2d302df66cc0d14db4c1dba93ba20b3eaf0d;hpb=a06ff95db570322cf86b713d4a6b410ea007b8e0;p=spider.git diff --git a/cmd/help.pl b/cmd/help.pl index afdd2d30..d87de981 100644 --- a/cmd/help.pl +++ b/cmd/help.pl @@ -14,7 +14,7 @@ my ($self, $line) = @_; my @out; # this is naff but it will work for now -$line = "help" if !$line; +$line = "help" unless $line; my $lang = $self->lang; $lang = 'en' if !$lang; @@ -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; + 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);