pkgjs / parseargs

Polyfill of `util.parseArgs()`
Apache License 2.0
121 stars 9 forks source link

Restructure result conventions (again again) #119

Closed aaronccasanova closed 2 years ago

aaronccasanova commented 2 years ago

I'm quite eager to see the parseArgs PR in Node cross the finish line, but since we missed the initial release should we consider one last time renaming the values result?

IMO, This property made sense when the associated parseArgs configuration API was withValue. However now we have switched to a config.options objects and combined the boolean options from the now legacy flags property.

If I think about it semantically, the parseArgs inputs are really an optionsConfig and the outputs are options.

Proposing

Before:

const { values } = parseArgs({ options })

After:

const { options } = parseArgs({ optionsConfig })

I imagine this update would be pretty frictionless with a simple find and replace. That being said, I absolutely don't want to hold things up and would be fine closing this issue here and now.

shadowspawn commented 2 years ago

I think the proposed naming is better, but probably not better enough to make the effort at this stage. šŸ˜«

ljharb commented 2 years ago

Why not ā€œconfigā€?

bakkot commented 2 years ago

"config" is not what I would generally call the collection of CLI arguments, personally.

shadowspawn commented 2 years ago

We use "config" as the name of the parameter: const parseArgs = (config = { __proto__: null })

ljharb commented 2 years ago

True, Iā€™d call them options, but theyā€™re both options :-) and ā€œoptionsConfigā€ is pretty wordy.

aaronccasanova commented 2 years ago

Yes, "optionsConfig" is definitely wordy! That's honestly my issue with it as well.

I think the proposed naming is better, but probably not better enough to make the effort at this stage.

Totally agree, this isn't worth the effort at this stage.

TBH I'm very happy with the current API and just wanted to quickly check if folks shared that opinion and/or had any alternative suggestions. Thanks for entertaining the idea all! šŸ‘