Skip to content

feat: show help for unknown flags and add showHelp function#79

Merged
gaureshpai merged 6 commits intomainfrom
fix/help-for-unknown-flags
Apr 23, 2026
Merged

feat: show help for unknown flags and add showHelp function#79
gaureshpai merged 6 commits intomainfrom
fix/help-for-unknown-flags

Conversation

@gaureshpai
Copy link
Copy Markdown
Owner

@gaureshpai gaureshpai commented Apr 23, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Improved command-line argument validation. The CLI now properly recognizes supported flags and displays usage information when invalid arguments are provided.

Confidence Score: 5/5

Safe to merge — the change is small, well-scoped, and the previously raised exit-code concern has been correctly resolved.

The PR makes a single-file change that correctly fixes the known issue. The exit code for unknown flags is now 1 (not 0), showHelp() is properly reused for the --help path, and no existing behaviour is broken. The only remaining note is a minor stdout/stderr mixing convention, which does not affect correctness.

No files require special attention.

Fix All in Codex Fix All in Claude Code Fix All in Cursor

Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/create-next-quick.js
Line: 59-63

Comment:
**Help text written to stdout on error path**

When `showHelp()` is called from the unknown-flags error path, the usage information is printed to `stdout` (via `console.log`) while the preceding error message is printed to `stderr` (via `console.error`). Mixing streams for a single logical error response can cause output ordering issues when the caller redirects one stream, and it deviates from the convention that all output for an error condition belongs on `stderr`.

A lightweight fix is to pass a `stream` argument (defaulting to `process.stdout` for the `--help` path) or just inline `process.stderr.write` for the error case:

```js
const showHelp = (out = process.stdout) => {
  out.write(`
Usage: create-next-quick [project-name] [options]
...
`);
};

// --help path
showHelp();                  // prints to stdout

// unknown flags path
showHelp(process.stderr);    // prints to stderr
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (3): Last reviewed commit: "Merge branch 'fix/help-for-unknown-flags..." | Re-trigger Greptile

- Extract help message into reusable showHelp() function
- Show help when unknown flags are provided instead of treating them as paths
- Fixes #77
@gaureshpai gaureshpai self-assigned this Apr 23, 2026
@gaureshpai gaureshpai added the bug Something isn't working label Apr 23, 2026
@coderabbitai

This comment was marked as resolved.

@coderabbitai

This comment was marked as duplicate.

@coderabbitai coderabbitai Bot added the enhancement New feature or request label Apr 23, 2026
Comment thread src/create-next-quick.js
gemini-code-assist[bot]

This comment was marked as resolved.

gaureshpai and others added 2 commits April 23, 2026 13:41
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 23, 2026

✅ CI/CD Test Results

Overall Status: success


View full workflow run

greptile-apps[bot]

This comment was marked as resolved.

@gaureshpai

This comment was marked as resolved.

@coderabbitai

This comment was marked as resolved.

gemini-code-assist[bot]

This comment was marked as resolved.

gaureshpai and others added 2 commits April 23, 2026 14:02
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@gaureshpai gaureshpai merged commit 85cdfe1 into main Apr 23, 2026
7 of 8 checks passed
@gaureshpai gaureshpai deleted the fix/help-for-unknown-flags branch April 23, 2026 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI treats flags as paths; should show help when no valid path is provided

1 participant