Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Hotell opened this issue Jan 14, 2021 · 2 comments
Open

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

Hotell opened this issue Jan 14, 2021 · 2 comments

Comments

@Hotell
Copy link

Hotell commented Jan 14, 2021

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 Hotell changed the title task help via option() doesn't do anything task help generation via option() doesn't do anything Jan 14, 2021
@Hotell Hotell changed the title task help generation via option() doesn't do anything bug: task help generation via option() doesn't do anything Jan 14, 2021
@Hotell Hotell changed the title bug: task help generation via option() doesn't do anything bug: task help generation via option() doesn't work Jan 18, 2021
@Tattoo
Copy link

Tattoo commented Jun 10, 2021

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

@Hotell
Copy link
Author

Hotell commented Jun 10, 2021

@Tattoo

I'd say your comment is probably not related to this issue. Pls check #504 . thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants