Add (and use) completion.use_best_match config

This commit is contained in:
Luca Benci 2017-10-07 15:42:42 +02:00
parent 9d0dfd5726
commit 71048a1b55
2 changed files with 8 additions and 1 deletions

View File

@ -218,7 +218,9 @@ class CommandParser:
for valid_command in cmdutils.cmd_dict: for valid_command in cmdutils.cmd_dict:
if valid_command.find(cmdstr) == 0: if valid_command.find(cmdstr) == 0:
matches.append(valid_command) matches.append(valid_command)
if len(matches) >= 1: if len(matches) == 1:
cmdstr = matches[0]
elif len(matches) > 1 and config.val.completion.use_best_match:
cmdstr = matches[0] cmdstr = matches[0]
return cmdstr return cmdstr

View File

@ -656,6 +656,11 @@ completion.web_history_max_items:
0: no history / -1: unlimited 0: no history / -1: unlimited
completion.use_best_match:
type: Bool
default: true
desc: Whether to execute the best-matching command on a partial match.
## downloads ## downloads
downloads.location.directory: downloads.location.directory: