parsing of strings containing flag notation
- Dominant language
- JavaScript
- Stars
- 681
- Forks
- 22
- PR merge metrics
- No merged PRs in 30d
Description
```js
#!/usr/bin/env node
const mri = require('mri')
console.log(process.argv)
console.log(mri(process.argv.slice(2)))
```
```shell
./args.js -a -b '-c foo'
```
```js
[
'/usr/local/Cellar/node/16.0.0_1/bin/node',
'/Users/j/web/pev2-cli/foo.js',
'-a',
'-b',
'-c foo'
]
{
_: [],
a: true,
b: true,
c: true,
' ': true,
f: true,
o: [ true, true ]
}
```
Is that intended?
I would have expected this:
```js
{
_: ['-c foo'],
a: true,
b: true
}
```
Or maybe this (but I find the result above much more intuitive):
```js
{
_: [],
a: true,
b: true,
c: 'foo'
}
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the reported case with the mri entry point and the shown process.argv.slice(2) arguments. Inspect how grouped flags and quoted values are parsed, then confirm the intended result with the project maintainers before defining tests or a completion criterion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100