Description
I have a script I'm converting from ruby that allows me to run arbitrary shell commands in a special mode. I define the command as something along the lines of $0 <cmd> [args...]
, but if i pass an unknown flag as part of args
, it gets taken out and treated like a regular flag. Is there any way I can set my script to skip parsing and validation of unknown flags?
Basically, I want a mode that treats unknown flags as regular arguments. If I run script.js ls -la .
, it should have argv.cmd
be 'ls'
and argv.args
be ['-la', '.']
, rather than putting something in argv.l
and argv.a
. I really like the functionality of yargs, but the fact that it parses out unknown flags is making it unusable for my purposes.
I haven't managed to find anything for this by looking through the documentation and code, so does yargs not support this? And if not, can support be added?
In case you would like to see my code, it can be found at https://github.com/henderea/jse, specifically the sudo
subcommand.