Hey ! The documentation on SkipFlagParsing says "Treat all flags as normal arguments if true".
However, it seems to also disable the parsing of subcommands. Example:
func main() {
app := &cli.Command{
SkipFlagParsing: true,
Before: func(ctx context.Context, c *cli.Command) (context.Context, error) {
fmt.Println(c.Args())
return ctx, nil
},
Action: func(ctx context.Context, c *cli.Command) error {
fmt.Println("Hello")
return nil
},
Commands: []*cli.Command{
{
Name: "subcmd",
SkipFlagParsing: false,
Before: func(ctx context.Context, c *cli.Command) (context.Context, error) {
fmt.Println(c.Args())
return ctx, nil
},
Action: func(ctx context.Context, c *cli.Command) error {
fmt.Println("subcmd Action")
return nil
},
},
},
}
err := app.Run(context.Background(), os.Args)
if err != nil {
log.Fatal(err)
}
}
If I run go run . subcmd, toggling SkipFlagParsing would produce different results (a different Action gets executed). I think this should be reflected in the docs
Hey ! The documentation on
SkipFlagParsingsays "Treat all flags as normal arguments if true".However, it seems to also disable the parsing of subcommands. Example:
If I run
go run . subcmd, togglingSkipFlagParsingwould produce different results (a differentActiongets executed). I think this should be reflected in the docs