Skip to content

Fix crash when no args passed in #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 10, 2019
Merged

Conversation

douglowder
Copy link
Collaborator

Fix #48 .

Root cause: The commander module seems to try to detect this problem and push the --help argument on process.argv. Unfortunately, that push is silently ignored, leading to the ugly error message issue.

Fix: Create our own args array, detect this condition, push --help onto the arg array, and then proceed with program.parse().

Snapshot test also added.

Copy link
Owner

@brody4hire brody4hire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the nice fix, merging now. Followup ideas and proposals will come next.

One followup is that it still does not seem to fix a couple cases of ugly error messages I described in #48 (comment):

  • create-react-native-module --asd
  • create-react-native-module --asd aa

P.S. My apologies for the extra comments which are now covered by a new PR and marked as resolved. (I forgot to delete them before submitting this review. My bad.)

@brody4hire
Copy link
Owner

Now published, thanks again for this fix and for your review of #111. You can see that I raised some followup PRs, my apologies for the extra comments which I forgot to delete before submitting my review. And thanks for your contributions in general.

@douglowder
Copy link
Collaborator Author

Very happy to help! This is a great tool and I intend to use it in my day job :) I don’t suppose you’d be interested in having this hosted in the react-native-community space?

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.

Ugly CLI exception if no command arguments are present
2 participants