Open
Description
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:
- POSIX which supports short options only, options must come before positional
- GNU adds long options, adds mixed order options and positionals
With reference implementations for C programs:
- getopt (short options only)
- getopt_long
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 |
- minimist and yargs share the same roots
- minimist is in maintenance mode.
- assuming yargs and yargs-parser are distinct for counts
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.
Metadata
Metadata
Assignees
Labels
No labels