davargs
This is the arguments processor that I use in my CLI tools. It is a very small wrapper around nopt
to help
with setting up defaults and sanatizing a little logic.
usage
var davargs = ; davargs; var options = davargs;console;
{ foo: true, help: false, version: false, baz: false }
options
The init
function allows for this config
known
- Theknown
object to use withnopt
shorts
- Theshorts
object to use withnopt
on
- An array of keys for theknown
object to set totrue
by defaultoff
- An array of keys for theknown
object to set tofalse
by default
There is also a provided has
method to check to see if an argument has been passed on the cli
reguardless of whether it's true or false. Useful when passing arguments down a layer to a subprocess.