Fix subcommand footer in help menu

This commit is contained in:
Evan Fiordeliso 2023-11-11 19:17:46 -05:00
parent 0cecbd6003
commit 43191d3ea2
2 changed files with 9 additions and 1 deletions

View File

@ -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 {
if c.parent == nil {
return filepath.Base(os.Args[0])

View File

@ -58,6 +58,6 @@ func (c *Command) ShowHelp() {
if len(c.subcommands) > 0 {
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())
}
}