hopefully got it right now!
[spider.git] / cmd / help.pl
index cf3dbd8b5a9e25a65f7e81c04bd596e060df8355..011519f626924268925dd17082852dedb56dc445 100644 (file)
@@ -14,7 +14,6 @@ my ($self, $line) = @_;
 my @out;
 
 # this is naff but it will work for now
-$line = "help" if !$line;
 my $lang = $self->lang;
 $lang = 'en' if !$lang;
 
@@ -41,10 +40,11 @@ if (!open($h, "$main::localcmd/Commands_$lang.hlp")) {
 }
 my $in;
 
-$line =~ s/![\w\/]//og;
-$line =~ s/\//\.\*\//og;
-$line =~ s/^\s+//og;
-$line =~ s/\s+$//og;
+$line =~ s/[^\w\/]//g;
+$line =~ s/\//\.\*\//g;
+$line =~ s/^\s+//g;
+$line =~ s/\s+$//g;
+$line = "help" if $line =~ /^\s*$/;
 
 # sort out aliases
 my $alias = CmdAlias::get_hlp($line);
@@ -59,7 +59,7 @@ foreach $in (<$h>) {
                $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;
                $state = 1;
                next;