From 03d4788a2cc1d3f79d858976c71d666d5a3eb5b3 Mon Sep 17 00:00:00 2001 From: librelad Date: Sat, 29 Aug 2026 02:42:30 +0100 Subject: [PATCH] fix(cli): show help on an unknown verb, and accept `validate` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two faults in the same dispatch branch. The unknown-command path called handleHelpCommands, which has never existed — the function is cliHandleHelpCommands. So every unrecognised verb printed "Unknown command" and then died on `handleHelpCommands: command not found`, withholding the help that was the entire purpose of the branch. Routing is the category DIRECTORY name, which is not always the word that comes to hand: `libreportal validate system` is what people type, and it fell into that same broken branch while the working spelling was `validation`. Map the synonym onto its directory rather than renaming the directory, so the handler name derived from it still resolves. Co-Authored-By: Claude Opus 5 --- scripts/cli/cli_initialize.sh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/scripts/cli/cli_initialize.sh b/scripts/cli/cli_initialize.sh index 3b02511..eef8204 100755 --- a/scripts/cli/cli_initialize.sh +++ b/scripts/cli/cli_initialize.sh @@ -13,12 +13,21 @@ cliInitialize() # Dynamic routing - auto-discover ALL categories! local category="$initial_command1" - + # Handle empty command as help if [[ -z "$category" ]]; then category="help" fi - + + # Verb aliases. Routing is the category DIRECTORY name, which is not always + # the word that comes to hand — `libreportal validate system` is what people + # type, and it failed as an unknown command while the working spelling was + # `validation`. Map the synonym onto its directory rather than renaming the + # directory, so the handler name derived below still matches. + case "$category" in + validate) category="validation" ;; + esac + local commands_file="$install_scripts_dir/cli/commands/$category/cli_${category}_commands.sh" local header_file="$install_scripts_dir/cli/commands/$category/cli_${category}_header.sh" @@ -41,7 +50,11 @@ cliInitialize() local help_commands_file="$install_scripts_dir/cli/commands/help/cli_help_commands.sh" if [[ -f "$help_commands_file" ]]; then source "$help_commands_file" - handleHelpCommands + # cliHandleHelpCommands, not handleHelpCommands — the latter has never + # existed, so every unrecognised verb printed "Unknown command" and + # then died on `handleHelpCommands: command not found` instead of + # showing the help that was the whole point of this branch. + cliHandleHelpCommands fi fi }