Skip to content
Myr

Print root usage when help called with no args.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Kevin Darlington · committed by spf13 · parent 1e1ff9e · Browse files · 1 file+3 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−2 removed

  • other:+3 added−2 removed

1 file+3 added−2 removed

modified:command.go+3 added-2 removed
17 unmodified lines
1819import (20 "bytes"21 "fmt"22 flag "github.com/spf13/pflag"22 "io"23 "os"24 "strings"2526 flag "github.com/spf13/pflag"27)2829// Command is just that, a command for your application.30// eg. 'go run' ... 'run' is the command. Cobra requires
106 unmodified lines
137 } else {138 return func(c *Command, args []string) {139 if len(args) == 0 {140 // Help called without any topic, calling on root140 c.Root().Help()141 c.Root().Usage()142 return143 }144145 cmd, _, e := c.Root().Find(args)
499 unmodified lines