Use []*Command instead of []Command in CommandsByName

main
Dan Buch 7 years ago
parent df5c6caa96
commit a372849da6
Signed by: meatballhat
GPG Key ID: 9685130D8B763EA7

@ -492,23 +492,22 @@ func main() {
Usage: "Load configuration from `FILE`", Usage: "Load configuration from `FILE`",
}, },
}, },
} Commands: []*cli.Command{
{
app.Commands = []cli.Command{ Name: "complete",
{ Aliases: []string{"c"},
Name: "complete", Usage: "complete a task on the list",
Aliases: []string{"c"}, Action: func(c *cli.Context) error {
Usage: "complete a task on the list", return nil
Action: func(c *cli.Context) error { },
return nil
}, },
}, {
{ Name: "add",
Name: "add", Aliases: []string{"a"},
Aliases: []string{"a"}, Usage: "add a task to the list",
Usage: "add a task to the list", Action: func(c *cli.Context) error {
Action: func(c *cli.Context) error { return nil
return nil },
}, },
}, },
} }

@ -56,7 +56,7 @@ type Command struct {
CustomHelpTemplate string CustomHelpTemplate string
} }
type CommandsByName []Command type CommandsByName []*Command
func (c CommandsByName) Len() int { func (c CommandsByName) Len() int {
return len(c) return len(c)

Loading…
Cancel
Save