getUsageTemplateFunc returns the usage template function for the command going up the command tree if necessary.
()
| 462 | // getUsageTemplateFunc returns the usage template function for the command |
| 463 | // going up the command tree if necessary. |
| 464 | func (c *Command) getUsageTemplateFunc() func(w io.Writer, data interface{}) error { |
| 465 | if c.usageTemplate != nil { |
| 466 | return c.usageTemplate.fn |
| 467 | } |
| 468 | |
| 469 | if c.HasParent() { |
| 470 | return c.parent.getUsageTemplateFunc() |
| 471 | } |
| 472 | return defaultUsageFunc |
| 473 | } |
| 474 | |
| 475 | // Usage puts out the usage for the command. |
| 476 | // Used when a user provides invalid input. |