module
Noir::CLI::Legacy
Overview
Translates v0.x terminal flags into v1 subcommand invocations.
In v0 these flags would parse, print something, and exit: --list-techs -> noir list techs --list-taggers -> noir list taggers --build-info -> noir version --verbose --generate-completion S -> noir completion S --help-all -> noir help
Non-terminal v0 flags (-b, -P, --ai-context, ...) stay in ARGV.
The router sends them to the default scan subcommand, which parses
them via its own OptionParser. That keeps noir -b ./app -P working
exactly as it did in v0.
Defined in:
cli/legacy.crConstant Summary
-
LEGACY_FLAG_ALIASES =
{"--send-req" => "--probe", "--send-proxy" => "--probe-via", "--send-es" => "--export-es", "--with-headers" => "--probe-header", "--use-matchers" => "--probe-match", "--use-filters" => "--probe-skip"} -
v0 deliver/probe flag tokens, translated to their v1 equivalents before the scan OptionParser sees ARGV. Doing the swap here keeps the LEGACY block out of
scan -h(and out of tab-completion) entirely — there's no shadowparser.onfor each old flag name — while existing CI scripts and v0 Dockerfile entrypoints keep parsing without modification. Mirrors the YAML-side migration inConfigInitializer::LEGACY_CONFIG_KEY_MAP. -
TERMINAL_REWRITES =
{"--list-techs" => ["list", "techs"], "--list-taggers" => ["list", "taggers"], "--build-info" => ["version", "--verbose"], "--help-all" => ["help"], "-v" => ["version"], "--version" => ["version"]} -
Global short-circuits. The first time any of these appear anywhere in ARGV the entire invocation is rewritten to the canonical v1 subcommand call, so flags that are inherently global (
-v,--version) behave the same no matter whether the user typed them before, after, or in place of a verb.
Class Method Summary
-
.rewrite(argv : Array(String)) : Array(String)
Returns a possibly-rewritten ARGV.
-
.translate_flag_aliases(argv : Array(String)) : Array(String)
Walks ARGV and rewrites any v0 deliver/probe flag token to its v1 equivalent.
Class Method Detail
Returns a possibly-rewritten ARGV. If a terminal v0 flag is found, the entire ARGV is replaced with the equivalent v1 invocation.
Walks ARGV and rewrites any v0 deliver/probe flag token to its v1
equivalent. Handles both the bare form (--send-proxy URL) and
the = form (--send-proxy=URL) so neither shape leaks the v0
name into the OptionParser. Unknown tokens pass through
unchanged — this method intentionally narrow.