util: add parseArgs module#42675
Merged
nodejs-github-bot merged 2 commits intonodejs:masterfrom May 24, 2022
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds util.parseArgs helper for higher level command-line argument parsing.
Background
There has been an ongoing effort in pkgjs/parseargs to define a command-line argument parsing API for Node.js core.
The effort has taken several years to get to this point, with many amazing contributors across a variety of companies and projects: IBM, Microsoft, Google, Shopify, npm, nvm, commander, yargs, just to name a few.
Where parseArgs is at
@shadowspawn, who's been most recently pushing a lot of the work on
parseArgsforward, indicates in pkgjs/parseargs/issues/87 that "we're close to having a decent MVP."I agree, and thought it would be worth having a candidate PR open on Node.js to get additional feedback.
This is a controversial topic, be kind
There's a lot of nuance and opinion, as to what constitutes a "decent MVP" for a command-line argument parser. Please be respectful of opinions you might not agree with 😊
Before leaving feedback on this thread, I suggest reading past issues on
parseArgs. Perhaps there's already been a discussion that touches on your feedback (or there's an ongoing discussion).Similarly, if themes of discussion jump out in this PR, let's move them to an issue in
parseArgs(this should help keep this PR less confusing).ToDo
CC: @ljharb, @bakkot, @iansu, @darcyclarke, @ruyadorno, @shadowspawn, @nodejs/tooling, @Trott (who I believe asked after this), @aaronccasanova.