console.lua: complete commands after help

And complete help itself.
This commit is contained in:
Guido Cella 2023-10-15 11:41:13 +02:00 committed by Dudemanguy
parent b6703873cf
commit e1ca04274d
1 changed files with 9 additions and 1 deletions

View File

@ -630,6 +630,13 @@ local function command_list()
return commands return commands
end end
local function command_list_and_help()
local commands = command_list()
commands[#commands + 1] = 'help'
return commands
end
local function property_list() local function property_list()
local option_info = { local option_info = {
'name', 'type', 'set-from-commandline', 'set-locally', 'default-value', 'name', 'type', 'set-from-commandline', 'set-locally', 'default-value',
@ -674,7 +681,8 @@ end
-- match. -- match.
function build_completers() function build_completers()
local completers = { local completers = {
{ pattern = '^%s*()[%w_-]+$', list = command_list, append = ' ' }, { pattern = '^%s*()[%w_-]+$', list = command_list_and_help, append = ' ' },
{ pattern = '^%s*help%s+()[%w_-]*$', list = command_list },
{ pattern = '^%s*set%s+"?([%w_-]+)"?%s+()%S*$', list = choice_list }, { pattern = '^%s*set%s+"?([%w_-]+)"?%s+()%S*$', list = choice_list },
{ pattern = '^%s*set%s+"?([%w_-]+)"?%s+"()%S*$', list = choice_list, append = '"' }, { pattern = '^%s*set%s+"?([%w_-]+)"?%s+"()%S*$', list = choice_list, append = '"' },
{ pattern = '^%s*cycle[-_]values%s+"?([%w_-]+)"?.-%s+()%S*$', list = choice_list, append = " " }, { pattern = '^%s*cycle[-_]values%s+"?([%w_-]+)"?.-%s+()%S*$', list = choice_list, append = " " },