-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
area/v2relates to / is being considered for v2relates to / is being considered for v2kind/bugdescribes or fixes a bugdescribes or fixes a bugstatus/triagemaintainers still need to look into thismaintainers still need to look into this
Description
My urfave/cli version is
v2.27.2
Dependency Management
- My project is using go modules.
Describe the bug
The v2 documentation states:
For bool flags you can specify the flag multiple times to get a count(e.g -v -v -v or -vvv)
It seems that you can specify the flag multiple times with -v -v -v
but not with -vvv
.
To reproduce
Minimal example to reproduce:
package main
import (
"fmt"
"log"
"os"
"github.com/urfave/cli/v2"
)
func main() {
var count int
app := &cli.App{
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "verbosity",
Aliases: []string{"v"},
Count: &count,
},
},
Action: func(cCtx *cli.Context) error {
fmt.Println("count", count)
return nil
},
}
if err := app.Run(os.Args); err != nil {
log.Fatal(err)
}
}
Observed behavior
Running this program without parameters works as expected.
Running with -v
works as expected.
Running with -v -v
works as expected.
Running with -vv
does not work as expected and prints following message:
2024/07/01 12:17:32 flag provided but not defined: -vv
Run go version
and paste its output here
go version go1.22.4 linux/amd64
Metadata
Metadata
Assignees
Labels
area/v2relates to / is being considered for v2relates to / is being considered for v2kind/bugdescribes or fixes a bugdescribes or fixes a bugstatus/triagemaintainers still need to look into thismaintainers still need to look into this