v2 - help text is always shown, even with `HideHelp: true`
SamuelMarks opened this issue · comments
My urfave/cli version is
v2.25.0
Checklist
- Are you running the latest v2 release? The list of releases is here.
- Did you check the manual for your release? The v2 manual is here
- Did you perform a search about this problem? Here's the GitHub guide about searching.
Describe the bug
A clear and concise description of what the bug is.
To reproduce
package main
import (
"fmt"
"os"
cli "github.com/urfave/cli/v2"
)
func main() {
app := &cli.App{
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "ls-remote",
Usage: "list available versions",
Action: func(ctx *cli.Context, v bool) error {
fmt.Println("printing versions")
return nil
},
},
},
HideHelp: true, // I have no idea why `--help` is always printing
}
if err := app.Run(os.Args); err != nil {
fmt.Println("never get here")
log.Fatal(err)
}
}
Observed behavior
Always prints the full --help
text, even if I provide --ls-remote
and that prints printing versions
first. Even tried an explicit HideHelp: true
.
Expected behavior
It should only show --help
if incorrect arg is provided or if --help
or -h
is explicitly provided.
Run go version
and paste its output here
go1.20
Maybe you can try to add an Action
that does nothing to the App. By default, it will use helpCommand.Action, which will print help information.
In addition, HideHelp
is not to hide help information, instead of providing no help command and help flag.
@Dokiys I'll give that a shot but you should consider addressing the problem as my code seems simple enough that it shouldn't bug-out like it does