pkgjs / parseargs

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

Reference specifications and implementations #76

Open shadowspawn opened 2 years ago

shadowspawn commented 2 years ago

I was thinking about what to consult for command-line parsing behaviours which people using the Node.js eco-system are likely to encounter.

The two specifications I am aware of are:

With reference implementations for C programs:


In Javascript world, we can look at npm dependencies as one measure of usage. Packages with over 1000 dependents (on 2022-03-06):

dependants package
61k commander
28k yargs (uses yargs-parser as engine)
19k minimist
6k meow (uses yargs-parser as engine)
4k @oclif/command
2k command-line-args
2k yargs-parser
2k argparse
1k nopt

For a second source for usage, this just came out: Census II of Free and Open Source Software — Application Libraries

In the top 500 npm packages as direct dependencies:

z-score package rank
2.2 commander 23
2.1 minimist 28
1.1 yargs 73
1.1 yargs-parser 75
1.1 @radic/yargs (?) 77
0.3 nopt 212
0.05 argparse 344

Across both measures, commander and yargs and minimist are the big 3 covering the majority of direct dependencies.

shadowspawn commented 1 year ago

For interest, minimist appears unmaintained at the moment. The GitHub source repo has been deleted.

ljharb commented 1 year ago

Yes, sadly substack deleted all their github repos. If @emilbayes is willing to npm owner add me, i'd be happy to reconstruct the repo and continue to maintain it.

shadowspawn commented 1 year ago

This fork has been active this year: https://github.com/meszaros-lajos-gyorgy/minimist-lite

ljharb commented 1 year ago

I've got the original git history up to v1.2.0 in 2015; a link to a repo that has commits through March 2022 would be appreciated :-)

shadowspawn commented 1 year ago

To be clear, I was pointing out an active fork by people who have already shown an interest and investment in maintaining Minimist, and might still be very interested. (Not offering an up-to-date source for git history.)

emilbayes commented 1 year ago

@ljharb I can :)

ljharb commented 1 year ago

@emilbayes thanks! If you have them, can you push the commits somewhere public so i can grab them?

shadowspawn commented 1 year ago

Hi @emilbayes !

I am also willing and able to be a steward of Minimist. I maintain Commander and very familiar with CLI parsing, and have been keeping an eye on Minimist for the last couple of years for interest. I offered an explanation on one issue (not in wayback so second-hand reference): https://github.com/meszaros-lajos-gyorgy/minimist-lite/issues/2

ljharb commented 1 year ago

minimist is now covered: https://twitter.com/ljharb/status/1579610392414007299