Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(flag): add UseShortOptionHandling description #1953

Merged
merged 3 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/v2/examples/flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ 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`.

<!-- {
"args": ["&#45;&#45;foo", "&#45;&#45;foo"],
"output": "count 2"
BlackHole1 marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -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,
},
},
Expand Down
4 changes: 4 additions & 0 deletions docs/v3/examples/flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ See full list of flags at https://pkg.go.dev/github.com/urfave/cli/v3

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 `Command.UseShortOptionHandling`.
BlackHole1 marked this conversation as resolved.
Show resolved Hide resolved

<!-- {
"args": ["&#45;&#45;foo", "&#45;&#45;foo"],
"output": "count 2"
BlackHole1 marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -126,10 +128,12 @@ func main() {
var count int

cmd := &cli.Command{
UseShortOptionHandling: true,
BlackHole1 marked this conversation as resolved.
Show resolved Hide resolved
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "foo",
Usage: "foo greeting",
Aliases: []string{"f"},
Config: cli.BoolConfig{
Count: &count,
},
Expand Down
Loading