Skip to content
Myr

Initialize help flag in initHelpCmd

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

Fix #302

authored by Albert Nigmatzianov · committed by Albert Nigmatzianov · parent 6ed17b5 · Browse files · 1 file+8 added−1 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+8 added−1 removed

  • other:+8 added−1 removed

1 file+8 added−1 removed

modified:command.go+8 added-1 removed
719 unmodified lines
720721func (c *Command) initHelpFlag() {722 c.mergePersistentFlags()723 if c.Flags().Lookup("help") == nil {724 usage := "help for "725 if c.Name() == "" {726 usage += "this command"727 } else {728 usage += c.Name()729 }724 c.Flags().BoolP("help", "h", false, "help for "+c.Name())730 c.Flags().BoolP("help", "h", false, usage)731 }732}733734func (c *Command) initHelpCmd() {
15 unmodified lines
750 if cmd == nil || e != nil {751 c.Printf("Unknown help topic %#q\n", args)752 c.Root().Usage()753 } else {754 cmd.initHelpFlag() // make possible 'help' flag to be shown755 cmd.Help()756 }757 },758 }
483 unmodified lines