Changeset 158
- Timestamp:
- 06/01/04 23:18:49 (4 years ago)
- Files:
-
- manage/trunk/CLI/CLI.pm (modified) (3 diffs)
- manage/trunk/manage (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
manage/trunk/CLI/CLI.pm
r156 r158 217 217 my $trackvar = 0; 218 218 219 # Skip if help 220 next if $rx =~ /^HELP/; 221 222 # Find out if this candidate is a unique minimum match 223 my $unique = 0; 224 225 if (defined($token)) { 226 my @candidates = grep(/^(?:\d+\)(?:\$))?$token/, keys(%cmd)); 227 $unique = 1 if @candidates == 1 and $candidates[0] eq $key; 228 } 229 219 230 # Remove ordering token 220 231 $rx =~ s/^\d+\)//; 221 222 # Skip if help223 next if $rx =~ /^HELP/;224 232 225 233 # Remove variable tracking token … … 229 237 } 230 238 231 if ( (!defined($token) and $rx eq 'ACTION') or (defined($token) and $token =~ /^(?:$rx)$/is)) {239 if ($unique or (!defined($token) and $rx eq 'ACTION') or (defined($token) and $token =~ /^(?:$rx)$/is)) { 232 240 my $type = ref($cmd{$key}); 233 241 … … 258 266 return ('ERROR', $error); 259 267 } else { 268 if (defined($token)) { 269 my @candidates = grep(/^(?:\d+\)(?:\$))?$token/, keys(%cmd)); 270 271 return ('ERROR', "No unique candidates for '$token', candidates are '@candidates'") 272 if @candidates > 1; 273 } 260 274 return ('ERROR', "Unrecognized command '$token'."); 261 275 } manage/trunk/manage
r157 r158 12 12 use Term::ReadLine::Gnu; 13 13 use POSIX qw(ctermid floor); 14 use Text::Wrap;15 14 use Fcntl qw(SEEK_SET SEEK_END SEEK_CUR O_RDONLY); 16 15 use IO::File; … … 217 216 ACTION => sub { 218 217 Term::ReadLine::Gnu->clear_history(); 218 info("History cleared"); 219 219 }, 220 220 HELP => "Clear the command line history."
