1.0.0 • Published 7 years agoCLI
exargs
Licence
MIT
Version
1.0.0
Deps
3
Size
10 kB
Vulns
0
Weekly
0
exargs
Expand your arguments, expand your mind.
Basically a cli wrapper for dargs that allows you to easily externalize arguments and flags
for passing to cli's that don't support .*rc or other configuration files.
Installation
npm install --save-dev exargs
# or
yarn add exargs
Usage
This utility depends on argument expansion in order to work properly.
// package.json
{
"scripts": {
"start:long": "mycmd --with=alot,of,arguments,oh,so,long --why=do,i,have,all,of,this,in,here --what=have,i,done,to,deserve,this",
"start:short": "mycmd $(exargs .mycmdrc)"
}
}
// .mycmdrc
{
"with": "alot,of,arguments,oh,so,long",
"why": "do,i,have,all,of,this,in,here",
"what": "have,i,done,to,deserve,this"
}
Options
All of the options accepted by dargs can be passed to exargs. The only way to pass these options currently is to add a $ property to the configuration file you have specified.
// .mycmdrc
{
"$": {
"combine": ["property"]
},
"property": ["one", "two"]
}
There are also some options added to make exargs more configurable:
combineArray - specify fields which should be rolled up into a single string to avoiddargsgenerating multiple arguments.
combine
Without combine:
{
"with": ["alot", "of", "arguments", "oh", "so", "long"]
}
// yields: --with=alot --with=of --with=arguments --with=oh --with=so --with=long
With combine:
{
"$": {
"combine": ["with"]
},
"with": ["alot", "of", "arguments", "oh", "so", "long"]
}
// yields: --with=alot --with=of --with=arguments --with=oh --with=so --with=long