module
Noir::CLI::Catalog
Overview
The noir command surface: which top-level verbs exist, what each one
does, and the fixed vocabulary that follows it.
Every consumer reads it from here — the router's dispatch, each command's
-h page, noir help, and the zsh/bash/fish/elvish completion
generators. Before this module the same six lists were written out in as
many places (KNOWN_COMMANDS, KNOWN_HELP_TARGETS, each command's
ACTIONS, and once per shell in completions.cr), with nothing linking
them: a renamed action stayed "valid" in three completion scripts, and a
new subcommand had to be remembered in six files or it silently went
uncompleted.
Defined in:
cli/catalog.crConstant Summary
-
CACHE_ACTIONS =
["info", "clear", "purge"] of ::String -
COMMANDS =
[Command.new("scan", "Discover endpoints in one or more codebases", args: "[PATHS...]"), Command.new("list", "Enumerate built-in catalogs", LIST_SUBJECTS), Command.new("cache", "Manage the on-disk LLM response cache", CACHE_ACTIONS), Command.new("config", "Manage the user-level YAML configuration", CONFIG_ACTIONS), Command.new("rules", "Manage the passive-scan rules repository", RULES_ACTIONS), Command.new("completion", "Generate a shell completion script", SHELLS), Command.new("version", "Print version (or full build details)", args: "[--verbose]"), Command.new("help", "Show this overview or a command's help", args: "[command]")] -
CONFIG_ACTIONS =
["show", "edit", "init", "path"] of ::String -
LIST_SUBJECTS =
["techs", "taggers", "formats"] of ::String -
Sub-action vocabularies. Each command module re-exports the one it owns, so
CacheCommand::ACTIONSstill reads naturally at its use site while the list itself lives in one place. -
NAMES =
COMMANDS.map(&.name) -
RULES_ACTIONS =
["list", "update", "path"] of ::String -
SHELLS =
["zsh", "bash", "fish", "elvish"] of ::String
Class Method Summary
-
.completable : Array(Tuple(String, Array(String)))
The verb → next-word vocabulary pairs a completion script needs, in the order its
caseshould test them.
Class Method Detail
The verb → next-word vocabulary pairs a completion script needs, in the
order its case should test them. scan is excluded: it is the
fallback branch every shell falls through to, and its next word is a
path or a flag rather than a fixed word.
help completes the verb list itself, which is why this can't simply be
Command#actions.