just icon indicating copy to clipboard operation
just copied to clipboard

bug: task help generation via option() doesn't work

Open Hotell opened this issue 4 years ago • 2 comments

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

image

just blimey --help

image

Expected behaviour

just blimey --help

Options:
  --name    user name or something                                                 [string]
  --help     Show help                                                 [boolean]
  --version  Show version number                                       [boolean]

Hotell avatar Jan 14 '21 16:01 Hotell

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')
})

Tattoo avatar Jun 10 '21 09:06 Tattoo

@Tattoo

I'd say your comment is probably not related to this issue. Pls check https://github.com/microsoft/just/issues/504 . thx

Hotell avatar Jun 10 '21 11:06 Hotell