Fix subcommand footer in help menu
This commit is contained in:
parent
0cecbd6003
commit
43191d3ea2
|
@ -38,6 +38,14 @@ func (c *Command) ApplyOptions(options ...Option) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Command) Root() *Command {
|
||||||
|
if c.isRoot {
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
|
return c.parent.Root()
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Command) CommandPath() string {
|
func (c *Command) CommandPath() string {
|
||||||
if c.parent == nil {
|
if c.parent == nil {
|
||||||
return filepath.Base(os.Args[0])
|
return filepath.Base(os.Args[0])
|
||||||
|
|
2
help.go
2
help.go
|
@ -58,6 +58,6 @@ func (c *Command) ShowHelp() {
|
||||||
|
|
||||||
if len(c.subcommands) > 0 {
|
if len(c.subcommands) > 0 {
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
fmt.Println("Run 'go-cli <command> --help' for more information about a command.")
|
fmt.Printf("Run '%s <command> --help' for more information about a command.\n", c.Root().CommandPath())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue