Skip to content
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

Improve command line argument parsing #262

Merged
merged 1 commit into from
May 4, 2021

Conversation

bjornstar
Copy link
Collaborator

Fixes #258

node has particular CLI usage patterns that are not supported by minimist. specifically, --inspect which has either no option or must include =.

I've added specific support for inspect & r / require. Unknown argument should be passed on to node.

We now throw if we cannot identify the script portion of the command line arguments. In the future we can instead list the command line arguments when this happens.

The way this now works is we manually handle the inspect options and remove them before passing the args off to minimist. We parse once with minimist to determine the location of the script and then parse again with the default values that we find in that script's directory.

I'll release this with a major version bump as I'm not 100% certain I covered all the use cases out there.

@bjornstar bjornstar merged commit cd091f6 into fgnass:master May 4, 2021
@bjornstar bjornstar deleted the improve-cli branch May 4, 2021 03:54
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.

Argument parsing is still broken in 6.7.0 (-r works but --require doesn't)
1 participant