Open
Description
opened on May 11, 2024
An issue from the original Minimist repo from @stevendesu with 11 upvotes
https://web.archive.org/web/20200904203616/https://github.com/substack/minimist/issues/136/
I have a command line argument that I wish to always be an array, but it may only contain one value:
Current Behavior
const argv = require("minimist")(process.argv.slice(2), {
alias: {
"distributions": ["d"]
}
});
console.log(argv);
$> node ./index.js -d one -d two
{ _: [],
distributions: ['one', 'two'],
d: ['one', 'two']
}
$> node ./index.js -d one
{ _: [],
distributions: 'one',
d: 'one'
}
Desired New Option
const argv = require("minimist")(process.argv.slice(2), {
array: ["distributions"], // <-----------------------------------
alias: {
"distributions": ["d"]
}
});
console.log(argv);
$> node ./index.js -d one
{ _: [],
distributions: ['one'],
d: ['one']
}
Metadata
Assignees
Labels
No labels
Activity