pkgjs / parseargs

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

feat: short with value in same arg #69

Closed shadowspawn closed 2 years ago

shadowspawn commented 2 years ago

(This PR builds on #68 so the diff is currently noisy. To see the new code in the meantime look for isShortAndValue.)

Add support for combining an option and its value in the same argument. For example these are the same using the tail command:

tail -n 3 index.js 
tail -n3 index.js 

Or with parseArgs:

parseArgs(['-n', '3'], { withValue: ['n'] });
parseArgs(['-n3'], { withValue: ['n'] });

NB: this is the classic pattern with value directly following short and not the same pattern included in #62 which used -n=3. Which might prompt some discussion...

shadowspawn commented 2 years ago

Working on redo of this with new configuration bag of options.

shadowspawn commented 2 years ago

Redid work in #75 after #63 landed.