HideHelpCommand issues
My urfave/cli version is
v3.3.3
Checklist
- [x] Are you running the latest v3 release? The list of releases is here.
- [x] Did you check the manual for your release? The v3 manual is here
- [ ] Did you perform a search about this problem? Here's the GitHub guide about searching.
Dependency Management
- My project is using go modules.
- My project is automatically downloading the latest version.
Describe the bug
I have noticed strange results produced by the default help template when my application is using HideHelpCommand:
Using HideHelpCommand in the root command and in a subcommand that has only one command (e.g. program config generate), the output is displayed without "COMMANDS" section.
https://go.dev/play/p/v7DRNLiVRzN
Using HideHelpCommand in the root only affects subcommands in the sense that "help" command is not shown in "COMMANDS" section, however the "help" command can still be invoked when it is specified as an argument.
https://go.dev/play/p/cGhEL-usWcW
To reproduce
I have attached Go playground links in the description.
Observed behavior
See the description.
Expected behavior
HideHelpCommand should hide help command from the usage output as well as disable the command when specified. Ideally, the behavior should be inherited from the parent command.
Additional context
None.
Want to fix this yourself?
We'd love to have more contributors on this project! If the fix for this bug is easily explained and very small, feel free to create a pull request for it.
Run go version and paste its output here
# paste `go version` output in here
Run go env and paste its output here
# paste `go env` output in here
Hi, I'm a bit confused—could you help me clarify this?
From what I understand, HideHelpCommand is meant to disable the help subcommand for a command, and as a result, it should prevent it from appearing in the COMMANDS section of the help output.
If that's correct, then I would expect that if I don't use HideHelpCommand, the help subcommand should appear for all of my subcommands. For example, with the code below, running app print should show help in the output. But I don't see help listed!
cmd := &cli.Command{
Commands: []*cli.Command{
{
Name: "print",
Commands: []*cli.Command{
{
Name: "text",
},
{
Name: "image",
},
},
},
},
}
NAME:
app print
USAGE:
app print [command [command options]]
COMMANDS:
text
image
help <-- This I expect to be there but it's not!
OPTIONS:
--help, -h show help
Hi @dnbsd ,
HideHelpCommand should hide help command from the usage output as well as disable the command when specified. Ideally, the behavior should be inherited from the parent command.
Out of curiosity, do you have a specific use case for disabling the help command altogether rather than just hiding it?
@Ali-Doustkani The issue you described does look like a bug.