From 43eafe13726f206caca52c7fbc536db7216f79f0 Mon Sep 17 00:00:00 2001 From: Kevin Cui Date: Thu, 18 Jul 2024 09:29:04 +0800 Subject: [PATCH 1/2] docs(flag): add `UseShortOptionHandling` description Signed-off-by: Kevin Cui --- docs/v2/examples/flags.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/v2/examples/flags.md b/docs/v2/examples/flags.md index f3792bff4b..2d4ffdc97f 100644 --- a/docs/v2/examples/flags.md +++ b/docs/v2/examples/flags.md @@ -104,9 +104,11 @@ See full list of flags at https://pkg.go.dev/github.com/urfave/cli/v2 For bool flags you can specify the flag multiple times to get a count(e.g -v -v -v or -vvv) +> If you want to support the `-vvv` flag, you need to set `App.UseShortOptionHandling`. + ```go package main @@ -123,10 +125,12 @@ func main() { var count int app := &cli.App{ + UseShortOptionHandling: true, Flags: []cli.Flag{ &cli.BoolFlag{ Name: "foo", Usage: "foo greeting", + Aliases: []string{"f"}, Count: &count, }, }, From 376a256f7acc6061f20dd8135fc55e7d501370b3 Mon Sep 17 00:00:00 2001 From: Kevin Cui Date: Mon, 12 Aug 2024 11:51:50 +0800 Subject: [PATCH 2/2] Update docs/v2/examples/flags.md Co-authored-by: dearchap --- docs/v2/examples/flags.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/v2/examples/flags.md b/docs/v2/examples/flags.md index 2d4ffdc97f..d7c15f6934 100644 --- a/docs/v2/examples/flags.md +++ b/docs/v2/examples/flags.md @@ -107,7 +107,7 @@ For bool flags you can specify the flag multiple times to get a count(e.g -v -v > If you want to support the `-vvv` flag, you need to set `App.UseShortOptionHandling`. ```go