Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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: 2 additions & 2 deletions docs/v1/examples/generated-help-text.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ VERSION:
`

// EXAMPLE: Replace the `HelpPrinter` func
cli.HelpPrinter = func(w io.Writer, templ string, data interface{}) {
cli.HelpPrinter = func(w io.Writer, templ string, data any) {
fmt.Println("Ha HA. I pwnd the help!!1")
}

Expand Down Expand Up @@ -103,4 +103,4 @@ func main() {
log.Fatal(err)
}
}
```
```
6 changes: 3 additions & 3 deletions docs/v1/examples/version-flag.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func init() {
cli.BashCompletionFlag = cli.BoolFlag{Name: "compgen", Hidden: true}
cli.VersionFlag = cli.BoolFlag{Name: "print-version, V"}

cli.HelpPrinter = func(w io.Writer, templ string, data interface{}) {
cli.HelpPrinter = func(w io.Writer, templ string, data any) {
fmt.Fprintf(w, "best of luck to you\n")
}
cli.VersionPrinter = func(c *cli.Context) {
Expand Down Expand Up @@ -345,7 +345,7 @@ func main() {
app.ErrWriter = &hexWriter{}
}

app.Metadata = map[string]interface{}{
app.Metadata = map[string]any{
"layers": "many",
"explicable": false,
"whatever-values": 19.99,
Expand All @@ -360,4 +360,4 @@ func wopAction(c *cli.Context) error {
fmt.Fprintf(c.App.Writer, ":wave: over here, eh\n")
return nil
}
```
```
6 changes: 3 additions & 3 deletions docs/v2/examples/full-api-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func init() {
cli.HelpFlag = &cli.BoolFlag{Name: "halp"}
cli.VersionFlag = &cli.BoolFlag{Name: "print-version", Aliases: []string{"V"}}

cli.HelpPrinter = func(w io.Writer, templ string, data interface{}) {
cli.HelpPrinter = func(w io.Writer, templ string, data any) {
fmt.Fprintf(w, "best of luck to you\n")
}
cli.VersionPrinter = func(cCtx *cli.Context) {
Expand Down Expand Up @@ -242,7 +242,7 @@ func main() {
fmt.Printf("made it!\n")
return ec
},
Metadata: map[string]interface{}{
Metadata: map[string]any{
"layers": "many",
"explicable": false,
"whatever-values": 19.99,
Expand All @@ -261,4 +261,4 @@ func wopAction(cCtx *cli.Context) error {
fmt.Fprintf(cCtx.App.Writer, ":wave: over here, eh\n")
return nil
}
```
```
4 changes: 2 additions & 2 deletions docs/v2/examples/generated-help-text.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ VERSION:
`

// EXAMPLE: Replace the `HelpPrinter` func
cli.HelpPrinter = func(w io.Writer, templ string, data interface{}) {
cli.HelpPrinter = func(w io.Writer, templ string, data any) {
fmt.Println("Ha HA. I pwnd the help!!1")
}

Expand Down Expand Up @@ -98,4 +98,4 @@ func main() {

(&cli.App{}).Run(os.Args)
}
```
```
6 changes: 3 additions & 3 deletions docs/v3/examples/full-api-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func init() {
cli.HelpFlag = &cli.BoolFlag{Name: "halp"}
cli.VersionFlag = &cli.BoolFlag{Name: "print-version", Aliases: []string{"V"}}

cli.HelpPrinter = func(w io.Writer, templ string, data interface{}) {
cli.HelpPrinter = func(w io.Writer, templ string, data any) {
fmt.Fprintf(w, "best of luck to you\n")
}
cli.VersionPrinter = func(cmd *cli.Command) {
Expand Down Expand Up @@ -216,7 +216,7 @@ func main() {
fmt.Printf("made it!\n")
return ec
},
Metadata: map[string]interface{}{
Metadata: map[string]any{
"layers": "many",
"explicable": false,
"whatever-values": 19.99,
Expand All @@ -235,4 +235,4 @@ func wopAction(ctx context.Context, cmd *cli.Command) error {
fmt.Fprintf(cmd.Root().Writer, ":wave: over here, eh\n")
return nil
}
```
```
4 changes: 2 additions & 2 deletions docs/v3/examples/help/generated-help-text.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ VERSION:
`

// EXAMPLE: Replace the `HelpPrinter` func
cli.HelpPrinter = func(w io.Writer, templ string, data interface{}) {
cli.HelpPrinter = func(w io.Writer, templ string, data any) {
fmt.Println("Ha HA. I pwnd the help!!1")
}

Expand Down Expand Up @@ -99,4 +99,4 @@ func main() {

(&cli.Command{}).Run(context.Background(), os.Args)
}
```
```
8 changes: 4 additions & 4 deletions help_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@
/*{
name: "standard-command",
template: "",
printer: func(w io.Writer, templ string, data interface{}) {
printer: func(w io.Writer, templ string, data any) {
fmt.Fprint(w, "yo")
},
command: "my-command",
Expand All @@ -530,9 +530,9 @@
{
name: "custom-template-command",
template: "{{doublecho .Name}}",
printer: func(w io.Writer, templ string, data interface{}) {
printer: func(w io.Writer, templ string, data any) {
// Pass a custom function to ensure it gets used
fm := map[string]interface{}{"doublecho": doublecho}
fm := map[string]any{"doublecho": doublecho}
HelpPrinterCustom(w, templ, data, fm)
},
command: "my-command",
Expand Down Expand Up @@ -2143,4 +2143,4 @@

_ = cmd.Run(buildTestContext(t), []string{"app", "help"})
assert.Contains(t, out.String(), UsageCommandHelp)
}
}

Check failure on line 2146 in help_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not properly formatted (gofumpt)
Loading