From e1ca04274dc411e1ef933da8394cc890296ab394 Mon Sep 17 00:00:00 2001 From: Guido Cella Date: Sun, 15 Oct 2023 11:41:13 +0200 Subject: [PATCH] console.lua: complete commands after help And complete help itself. --- player/lua/console.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/player/lua/console.lua b/player/lua/console.lua index 2c3b7b4374..f47ef15c3e 100644 --- a/player/lua/console.lua +++ b/player/lua/console.lua @@ -630,6 +630,13 @@ local function command_list() return commands end +local function command_list_and_help() + local commands = command_list() + commands[#commands + 1] = 'help' + + return commands +end + local function property_list() local option_info = { 'name', 'type', 'set-from-commandline', 'set-locally', 'default-value', @@ -674,7 +681,8 @@ end -- match. function build_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, append = '"' }, { pattern = '^%s*cycle[-_]values%s+"?([%w_-]+)"?.-%s+()%S*$', list = choice_list, append = " " },