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 }