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

Subcommand not registered if no description provided during the setup #633

Closed
k0pernikus opened this issue May 31, 2017 · 2 comments
Closed

Comments

@k0pernikus
Copy link

k0pernikus commented May 31, 2017

I wanted to setup a cli with git style subcommands. Hence, created these files:

test.js
test-foo.js
test-bar.js

In my test.js, where I define the app, if I set the command description:

program
    .version('1.0.0')
    .command('foo', 'foo action')
    .command('bar', 'bar action')
    .parse(process.argv);

Everything works as expected:

$ node dist/test.js --help

  Usage: test [options] [command]


  Commands:

    foo         foo action
    bar         bar action
    help [cmd]  display help for [cmd]

  Options:

    -h, --help     output usage information
    -V, --version  output the version number

Yet at first I omitted the description for the test case:

program
    .version('1.0.0')
    .command('foo')
    .command('bar')
    .parse(process.argv);

and then only the bar command seems added:

node dist/test.js --help

  Usage: bar [options]

  Options:

    -h, --help  output usage information

As a developer I find that counter-intuitive and would have expected an error to be thrown in my face or for the two commands to be added with or without description.

@shadowspawn
Copy link
Collaborator

This issue has not had any activity in over six months. It isn't likely to get acted on due to this report.

Feel free to open a new issue if it comes up again, with new information and renewed interest.

Thank you for your contributions.

@shadowspawn
Copy link
Collaborator

(I have this issue noted for future reference, common report of confusion over switching modes based on description.)

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