Repository navigation
Commit 5ac45e7
HCL
fix(cli): use FLAG_TERMINATOR constant in getCommandPathInternal (#83902)
`getCommandPathInternal` compared `arg === "--"` directly, while every
other helper in `argv.ts` (`isHelpOrVersionInvocation`, `hasFlag`,
`hasRootVersionAlias`, `isRootInvocationForFlags`, `getFlagValue`,
`getCommandPositionals`, etc.) routes its terminator check through the
imported `FLAG_TERMINATOR` constant from `infra/cli-root-options.ts`.
Under the current value (`"--"`) the two paths agree, but any future
change to the constant would silently desync command-path resolution
from help/version detection — subcommand routing would break in a way
that's hard to trace because the rest of the parser would still pick up
the new terminator.
Replace the hardcoded literal with `FLAG_TERMINATOR` and pin a regression
test that pulls the live constant through the same module-resolution
path the production code uses.
Closes #83902.1 parent d124c5a commit 5ac45e7
2 files changed
Lines changed: 24 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
262 | 280 | | |
263 | 281 | | |
264 | 282 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
225 | | - | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
226 | 231 | | |
227 | 232 | | |
228 | 233 | | |
| |||
0 commit comments