You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently option() works on global level (one singleton via an object).
While this behaviour might be ok for task or two, one will start having issue in bigger project.
To support good DX it should be able to locally scope option per task, which would have following outcomes:
properly generate CLI flags when --help is invoked on particular task
properly apply yargs parser on particular task
New Contrived API proposal
const{ task, logger, option, argv }=require('just-task');task('blimey','An exclamation of surprise.',function(){logger.info(`blimey! ${argv().name}`);}).option('name',{describe: 'user name or something'})task('greet','say hi.',function(){logger.info(`say hi! ${argv().greeting}${argv().who} !`);}).option('greeting',{describe: 'what greeting should be used'}).option('who',{describe: 'who should we greet?'})
which would work like following:
just blimey --help
Options:
--name user name or something [string]
--help Show help [boolean]
--version Show version number [boolean]
just greet --help
Options:
--greeting what greeting should be used [string]
--who who should we greet [string]
--help Show help [boolean]
--version Show version number [boolean]
The text was updated successfully, but these errors were encountered:
Currently
option()
works on global level (one singleton via an object).While this behaviour might be ok for task or two, one will start having issue in bigger project.
To support good DX it should be able to locally scope option per task, which would have following outcomes:
--help
is invoked on particular taskNew Contrived API proposal
which would work like following:
just blimey --help Options: --name user name or something [string] --help Show help [boolean] --version Show version number [boolean]
just greet --help Options: --greeting what greeting should be used [string] --who who should we greet [string] --help Show help [boolean] --version Show version number [boolean]
The text was updated successfully, but these errors were encountered: