Skip to content

Repeated similarly named flags & Before() doesn't go before --help global option. #2174

@Olimpian

Description

@Olimpian

A new case to use beforeFun() before --help flag is to set up a language for that help-information.
And also it is really strange, that help as a function calls befireFuns(), but help as a flag - is not, imho.

UPDATE:
Version: github.com/urfave/cli/v3 v3.3.8
Also, if i add new BoolFlag with Name = "help", it adds without problems. And it is shown in help-message, but you can't call it, cause standard --help is in prior. And you can do it for every command, not only for app. And copied flag several types.

&cli.Command{
	Name: "comand1",
	Flags: []cli.Flag{
		&cli.BoolFlag{
			Name: "help",
		},
		&cli.BoolFlag{
			Name: "help",
		},
	},
}

and if you call
app command1 --help
you will see:

OPTIONS:
   --help      (default: false)
   --help      (default: false)
   --help, -h  show help

And you can create similarly named flags of any type or name.
I think it's a bug...

Originally posted by @Olimpian in #1719

Metadata

Metadata

Assignees

Labels

area/v3relates to / is being considered for v3kind/bugdescribes or fixes a bugstatus/triagemaintainers still need to look into this

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions