-
Notifications
You must be signed in to change notification settings - Fork 10
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
Thoughts, post MVP #124
Comments
I think the main thing is to write examples for ~half a dozen of the most common cases. Unfortunately the node docs don't tend to go in for having so many examples, in my experience, so I'm not sure where such docs would live. |
I am not sure I understand this offer, like submitting a future PR with |
Ah, a compact hand-parser! There is one behaviour I think the behaviour matches up with |
Woop woop! In nightly build. % n nightly
copying : nightly/19.0.0-nightly20220525810893f145
installed : v19.0.0-nightly20220525810893f145 (with npm 8.10.0)
% node -e 'console.log(util.parseArgs({ strict: false }))' -- -ab --foo=bar bongo
{
values: [Object: null prototype] { a: true, b: true, foo: 'bar' },
positionals: [ 'bongo' ]
} |
It can be somewhat daunting going through the code review process for your first few PRs in the Node codebase, I'm happy to help with the process. My hope is that we can keep some momentum and have some follow up PRs.
@Trott, @mhdawson, do you have any thoughts about where this type of documentation could live?
@bakkot I'm wondering, with the addition of indices, is there an elegant way we could implement a parser that terminates the parse early on the first positional? |
I was actually just in the process of opening an issue for that.
It's doable, but I wouldn't call it elegant. You can parse once with |
@mhdawson : docs on how to use parseArgs (thanks) |
@shadowspawn we could update this article: https://nodejs.org/en/knowledge/command-line/how-to-parse-command-line-arguments/ @mhdawson do we find that folks find these knowledge base articles? what's the process for updating them. |
I would put it in the regular docs. If people complain, then split it out into a separate guide to live on the website, but don't do that preemptively. I think there are a lot of people who feel like our docs don't contain enough examples. The separate guides tend to get ignored and go out of date and so avoiding that and just having it all in the API ref doc is the way to go, IMO. |
+1 to what @Trott said, for examples on how to use parseArgs the regular docs make the most sense to me. |
If we need out-of-line examples, I stumbled across this tonight:
|
We're close to landing the MVP of
parseAargs
, I'd like to avoid losing momentum as we've got such a great set of contributors.Stuff I'd love to do post-MVP
parseArgs
.Once we land the MVP I would love to help enable some other folks contributing to Node core, let me know who's interested.
The text was updated successfully, but these errors were encountered: