diff --git a/docs/v2/examples/flags.md b/docs/v2/examples/flags.md index f84fcdd7a7..f048def27c 100644 --- a/docs/v2/examples/flags.md +++ b/docs/v2/examples/flags.md @@ -245,7 +245,7 @@ import ( ) func main() { - app = &cli.App{ + app := &cli.App{ Flags: []cli.Flag{ &cli.BoolFlag{ Name: "silent", diff --git a/docs/v2/examples/subcommands-categories.md b/docs/v2/examples/subcommands-categories.md index 5f0b8d2e11..aeddea5a92 100644 --- a/docs/v2/examples/subcommands-categories.md +++ b/docs/v2/examples/subcommands-categories.md @@ -9,6 +9,9 @@ For additional organization in apps that have many subcommands, you can associate a category for each command to group them together in the help output, e.g.: + ```go package main @@ -48,7 +51,7 @@ Will include: COMMANDS: noop - Template actions: + template: add remove -``` +``` \ No newline at end of file diff --git a/docs/v2/examples/timestamp-flag.md b/docs/v2/examples/timestamp-flag.md index 4e19adfd13..7f63a58abd 100644 --- a/docs/v2/examples/timestamp-flag.md +++ b/docs/v2/examples/timestamp-flag.md @@ -51,10 +51,25 @@ When the layout doesn't contain timezones, timestamp will render with UTC. To change behavior, a default timezone can be provided with flag definition: ```go -app := &cli.App{ - Flags: []cli.Flag{ - &cli.TimestampFlag{Name: "meeting", Layout: "2006-01-02T15:04:05", Timezone: time.Local}, - }, +package main + +import ( + "log" + "time" + "os" + "github.com/urfave/cli/v2" +) + +func main() { + app := &cli.App{ + Flags: []cli.Flag{ + &cli.TimestampFlag{Name: "meeting", Layout: "2006-01-02T15:04:05", Timezone: time.Local}, + }, + } + + if err := app.Run(os.Args); err != nil { + log.Fatal(err) + } } ```