-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Description
What's happening
If you pass an unrecognized flag (e.g. metacall-deploy --not-a-real-flag),
the CLI prints a warning and the help text, but exits with code 0.
This breaks any CI pipeline or shell script that checks the exit code to detect invalid usage.
Steps to reproduce
metacall-deploy --not-a-real-flag
echo $? What you'd expect
Exit code 1 (or any non-zero) when an unknown flag is passed.
What actually happens
process.exit(0) because handleUnknownArgs() calls printHelp() which always exits with ErrorCode.Ok.
Relevant files:
src/cli/unknown.ts// always callsprintHelp()src/help.ts// always exits withErrorCode.Ok
The fix
Add an optional exit code param to printHelp:
// src/help.ts
export const printHelp = (exitCode = ErrorCode.Ok) => {
// ...
process.exit(exitCode);
};Then call it with 1 from the unknown-args path:
// src/cli/unknown.ts
printHelp(1);Keep 0 only for explicit --help. Happy to fix this.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels