From 5252292b499e09ef67de02bdcc916fbbdf5dcebd Mon Sep 17 00:00:00 2001 From: Sam Whited Date: Sat, 10 Nov 2018 09:26:01 -0600 Subject: [PATCH] cli: simplify example code --- example_subcommands_test.go | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/example_subcommands_test.go b/example_subcommands_test.go index 6c4b9b4..71ee57b 100644 --- a/example_subcommands_test.go +++ b/example_subcommands_test.go @@ -18,30 +18,26 @@ func Example_subcommands() { fmt.Println("Ran go") return nil }, - Commands: []*cli.Command{ - &cli.Command{ - Usage: `mod [arguments]`, - Description: `Go mod provides access to operations on modules. + Commands: []*cli.Command{{ + Usage: `mod [arguments]`, + Description: `Go mod provides access to operations on modules. Note that support for modules is built into all the go commands…`, - Run: func(c *cli.Command, args ...string) error { - fmt.Println("Ran go mod") - return nil - }, - Commands: []*cli.Command{ - &cli.Command{ - Usage: `tidy [-v]`, - Description: `Add missing and remove unused modules. + Run: func(c *cli.Command, args ...string) error { + fmt.Println("Ran go mod") + return nil + }, + Commands: []*cli.Command{{ + Usage: `tidy [-v]`, + Description: `Add missing and remove unused modules. Tidy makes sure go.mod matches the source code in the module…`, - Run: func(c *cli.Command, args ...string) error { - fmt.Println("Ran go mod tidy") - return nil - }, - }, + Run: func(c *cli.Command, args ...string) error { + fmt.Println("Ran go mod tidy") + return nil }, - }, - }, + }}, + }}, } cmds.Commands = append(cmds.Commands, cli.Help(cmds)) fmt.Println("$ go help")