Skip to content
Myr

Initialize the --help flag as late as possible

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

This should let users overwrite it with something custom. Like the help sub-command.

authored by Eric Paris · committed by Eric Paris · parent 7cd6c9c · Browse files · 1 file+3 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+3 added−1 removed

  • other:+3 added−1 removed

1 file+3 added−1 removed

modified:command.go+3 added-1 removed
559 unmodified lines
560 return561}562563func (c *Command) initHelp() {564 if c.Flags().Lookup("help") == nil {565 c.Flags().BoolVarP(&c.helpFlagVal, "help", "h", false, "help for "+c.Name())566 }567 if c.helpCommand == nil {568 if !c.HasSubCommands() {569 return570 }
290 unmodified lines
861 if c.flagErrorBuf == nil {862 c.flagErrorBuf = new(bytes.Buffer)863 }864 c.flags.SetOutput(c.flagErrorBuf)862 c.PersistentFlags().BoolVarP(&c.helpFlagVal, "help", "h", false, "help for "+c.Name())865 }866 return c.flags867}868
165 unmodified lines