Open medikoo opened 3 years ago
An option argument that starts with a dash is problematic as Yargs assumes it might be an option instead. You can set nargs to make the option "greedy" and consume option arguments that start with a dash.
A user work-around (no author action required) is to use an equals: --docker-args="-p 5432:5432"
I didn't make this clear in my previous comment, but the quotes get stripped by the shell interpreter before node or yargs see them. You can confirm this for yourself by writing out process.argv
. [Edit: as you noted in your comment!]
What yargs is working with is ['--docker-args' , '-p 5432:5432']
Let's say I invoke a CLI with following arguments:
In Node.js trailing part of
process.argv
resolves to:Now when I put it to
yargs-parser
, result is not expected:While expected result is: