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

Detailed help for default command is inaccessible #95

Open
cspotcode opened this issue Aug 20, 2021 · 4 comments
Open

Detailed help for default command is inaccessible #95

cspotcode opened this issue Aug 20, 2021 · 4 comments

Comments

@cspotcode
Copy link

When running clitool --help with a default command and other subcommands, clipanion will output a list of commands. It will say You can also print more details about any of these commands by calling them with the -h,--help flag right after the command name.

However, the default command does not have a command name, so there is no way to get more details about the default command.

I'm not sure if/how this should be supported. If the default command is given an additional, non-default path, and if that non-default path is specified before Command.Default, then the path will appear in --help documentation. The output will not, however, indicate that this command is the default.

@arcanis
Copy link
Owner

arcanis commented Aug 20, 2021

Did you check with 3.0.1? It should be fixed starting from 2e91023

@arcanis
Copy link
Owner

arcanis commented Aug 20, 2021

Although this behavior only triggers if you don't have other documented commands. If you do, then your best option is to also give a name to your "main" command (just like we do with yarn, which also has its own name via yarn install).

@cspotcode
Copy link
Author

Right, this issue is about when you have other documented commands.

@paul-soporan
Copy link
Contributor

so there is no way to get more details about the default command.

There actually is, but it's undocumented. --help can work as a bound option that accepts a number, causing --help=<n> to display the help of the nth command registration with the provided path.

In Yarn's case for example:

  • running yarn --help=0 or yarn -h=0 displays the usage of the EntryCommand:
  • running yarn --help=1 or yarn -h=1 displays the usage of the InstallCommand

Once I finish the completion PR, --help=<tab> and -h=<tab> will be automatically completed:

image

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

3 participants