Skip to content

Commit

Permalink
Merge pull request #1652 from urfave/revert-1651-issue_1593
Browse files Browse the repository at this point in the history
Revert "Doc:(issue_1593) Add flag category topic in docs"
  • Loading branch information
dearchap committed Jan 18, 2023
2 parents 531e838 + 6fb36b3 commit 3e0609a
Showing 1 changed file with 0 additions and 51 deletions.
51 changes: 0 additions & 51 deletions docs/v2/examples/flags.md
Expand Up @@ -230,57 +230,6 @@ That flag can then be set with `--lang spanish` or `-l spanish`. Note that
giving two different forms of the same flag in the same command invocation is an
error.

#### Grouping

You can associate a category for each flag to group them together in the help output, e.g:

```go
package main

import (
"log"
"os"

"github.com/urfave/cli/v2"
)

func main() {
app = &cli.App{
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "silent",
Aliases: []string{"s"},
Usage: "no messages",
Category: "Miscellaneous:",
},
&cli.BoolFlag{
Name: "perl-regexp",
Aliases: []string{"P"},
Usage: "PATTERNS are Perl regular expressions",
Category: "Pattern selection:",
},
},
}

if err := app.Run(os.Args); err != nil {
log.Fatal(err)
}
}
```

Will result in help output like:

```
GLOBAL OPTIONS:
Miscellaneous:
--silent, -s no messages (default: false)
Pattern selection:
--perl-regexp, -P PATTERNS are Perl regular expressions (default: false)
```

#### Ordering

Flags for the application and commands are shown in the order they are defined.
Expand Down

0 comments on commit 3e0609a

Please sign in to comment.