Closed
Description
It seems that BoolWithInverseFlags are working as expected with v3.3.3 but I don't see them printed in the help. In the example below I would expect to see --foo
under the global options.
Example:
package main
import (
"context"
"fmt"
"log"
"os"
"github.com/urfave/cli/v3"
)
func main() {
cmd := &cli.Command{
Flags: []cli.Flag{
&cli.BoolWithInverseFlag{
Name: "foo",
Value: false,
Usage: "use some foo",
Hidden: false,
},
},
Action: func(ctx context.Context, cmd *cli.Command) error {
if cmd.Bool("foo") {
fmt.Println("foo is set")
} else {
fmt.Println("no-foo is set")
}
return nil
},
}
if err := cmd.Run(context.Background(), os.Args); err != nil {
log.Fatal(err)
}
}
Output:
➜ urfave_v3_test go run main.go -h
NAME:
main - A new cli application
USAGE:
main [global options]
GLOBAL OPTIONS:
--help, -h show help
➜ urfave_v3_test go run main.go --foo
foo is set
➜ urfave_v3_test go run main.go --no-foo
no-foo is set