Skip to content

fix(cli): exit with non-zero code for unknown flags - #252

Open
prathamesh04 wants to merge 1 commit into
metacall:masterfrom
prathamesh04:fix/unknown-flags-exit-code
Open

fix(cli): exit with non-zero code for unknown flags#252
prathamesh04 wants to merge 1 commit into
metacall:masterfrom
prathamesh04:fix/unknown-flags-exit-code

Conversation

@prathamesh04

Copy link
Copy Markdown

Description

The CLI was exiting with code 0 when unknown flags were passed, breaking CI pipelines and shell scripts that check exit codes.

Fixes #212

Changes

  • Add UnknownFlag error code to ErrorCode enum
  • Add optional exitCode parameter to printHelp()
  • Exit with ErrorCode.UnknownFlag when unknown flags are detected
  • Keep exit code 0 for explicit --help flag

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • Build passes (npm run build)
  • Lint passes (npm run lint)

The CLI was exiting with code 0 when unknown flags were passed,
breaking CI pipelines and shell scripts that check exit codes.

Changes:
- Add UnknownFlag error code to ErrorCode enum
- Add optional exitCode parameter to printHelp()
- Exit with ErrorCode.UnknownFlag when unknown flags are detected
- Keep exit code 0 for explicit --help flag

Fixes metacall#212
@prathamesh04

Copy link
Copy Markdown
Author

cc @viferga @josead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: unknown CLI flags exit with code 0 instead of a failure code

1 participant