fix(cli): show help on an unknown verb, and accept validate
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 <noreply@anthropic.com>
This commit is contained in:
parent
1ed42c7645
commit
03d4788a2c
@ -13,12 +13,21 @@ cliInitialize()
|
|||||||
|
|
||||||
# Dynamic routing - auto-discover ALL categories!
|
# Dynamic routing - auto-discover ALL categories!
|
||||||
local category="$initial_command1"
|
local category="$initial_command1"
|
||||||
|
|
||||||
# Handle empty command as help
|
# Handle empty command as help
|
||||||
if [[ -z "$category" ]]; then
|
if [[ -z "$category" ]]; then
|
||||||
category="help"
|
category="help"
|
||||||
fi
|
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 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"
|
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"
|
local help_commands_file="$install_scripts_dir/cli/commands/help/cli_help_commands.sh"
|
||||||
if [[ -f "$help_commands_file" ]]; then
|
if [[ -f "$help_commands_file" ]]; then
|
||||||
source "$help_commands_file"
|
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
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user