Flag without an alias is being reported as unknown
- Dominant language
- JavaScript
- Stars
- 681
- Forks
- 22
- PR merge metrics
- No merged PRs in 30d
Description
```js
import mri from "mri";
const parsed = mri(process.argv.slice(2), {
string: ["foo", "bar"],
alias: { f: "foo" },
unknown(flag) {
console.error(`Unknown flag: ${flag}`);
process.exit(1);
},
});
console.log(parsed);
```
Then run the following command:
```sh
node repro.js --bar
```
## Expected
Log the parsed flags and exit without error.
## Actual
Logs `Unknown flag: --bar` and exits with code 1.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by running the issue's repro with `node repro.js --bar`, then trace mri's flag parsing and the path that invokes the `unknown` callback. The work is done when `--bar` is accepted as declared in `string`, the parsed flags are logged, and the process exits without error.
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
- Mostly clear
- Newbie friendliness
- 55/100