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

Impossible to customise descriptions of --help and --version options #473

Closed
Alhadis opened this issue Dec 3, 2015 · 8 comments
Closed

Comments

@Alhadis
Copy link

Alhadis commented Dec 3, 2015

Say I wanted to use a different wording for the --version or --help options in the auto-generated help output:

program
    .version("0.0.1")
    .option("-p, --peppers",   "Add peppers")
    .option("-P, --pineapple", "Add pineapple")
    .option("-c, --cheese",    "Add cheese")
    .option("-h, --help",      "Display this help message and exit")
    .option("-V, --version",   "Display the version of the running program")

... I can't. Specifying --help prevents the --help option from even doing anything, and specifying --version just duplicates the option in the --help output:

  Usage: index [options]

  Options:

    -h, --help       output usage information
    -V, --version    output the version number
    -p, --peppers    Add peppers
    -P, --pineapple  Add pineapple
    -c, --cheese     Add cheese
    -V, --version    Display the version of the running program

Shouldn't there be a way of overriding those two option descriptions? Some users might wish to use a different wording, or at least correct the capitalisation.

@Alhadis
Copy link
Author

Alhadis commented Dec 8, 2015

This is probably never gonna be looked-at, if this package's recent traction is anything to go by.

Have taken it upon myself to develop a simpler and more hands-on alternative instead:
https://www.npmjs.com/package/get-options

Thanks anyway. =) Will leave this open in case somebody does feel like it warrants actioning.

@ghost
Copy link

ghost commented Dec 11, 2015

+1

@hacksalot
Copy link

You could always do:

var Command = require('commander').Command;

Command.prototype.helpInformation = function() {
    return "My help information!!"
};

/* Do stuff with Command */

@Alhadis
Copy link
Author

Alhadis commented Jan 3, 2016

Haha, maybe. :D

Too late now, though. Really happy with how this turned out. =)

@fatso83
Copy link

fatso83 commented Mar 14, 2016

Duplicate of #471 . Think we'll have to check out your project :-) This is just way too buggy.

@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.

The issue author has done their own approach, and there are other issues covering this area such as #47.

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

This issue will be resolved when v3.0.0 is released. Available now as a prerelease. See #1001

@shadowspawn
Copy link
Collaborator

Support for customising the version and help descriptions has shipped in v3 (thanks @idmontie): https://github.com/tj/commander.js/releases/tag/v3.0.0

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

4 participants