bug: task help generation via option() doesn't work
Hotell opened this issue · 2 comments
Hotell commented
Repro
const { task, logger, option, argv } = require('just-task');
option('name', {describe: 'user name or something'});
task('blimey', 'An exclamation of surprise.', function() {
logger.info(`blimey! ${argv().name}`);
});
Actual behaviour
Basically --help
output always invokes yargs default help command.
just --help
just blimey --help
Expected behaviour
just blimey --help
Options:
--name user name or something [string]
--help Show help [boolean]
--version Show version number [boolean]
Tattoo commented
option()
as a mechanism is a poor choice for providing command line arguments, as then all arguments defined with it will be global to all tasks. It would be much nicer if I could define options per task:
const { task, logger, option, argv } = require('just-task');
option('name', {describe: 'user name or something'});
task('blimey', 'An exclamation of surprise.', function() {
logger.info(`blimey! ${argv().name}`);
});
task('something', 'This task does not use arguments', function() {
logger.info('I do not use name, yet the help text shows it as a valid argument')
})