1.0.0 • Published 6 years ago
exargs v1.0.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 exargsUsage
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=longWith combine:
{
"$": {
"combine": ["with"]
},
"with": ["alot", "of", "arguments", "oh", "so", "long"]
}
// yields: --with=alot --with=of --with=arguments --with=oh --with=so --with=long1.0.0
6 years ago