MCPcopy
hub / github.com/spf13/cobra / getUsageTemplateFunc

Method getUsageTemplateFunc

command.go:464–473  ·  view source on GitHub ↗

getUsageTemplateFunc returns the usage template function for the command going up the command tree if necessary.

()

Source from the content-addressed store, hash-verified

462// getUsageTemplateFunc returns the usage template function for the command
463// going up the command tree if necessary.
464func (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.

Callers 1

UsageFuncMethod · 0.95

Calls 1

HasParentMethod · 0.95

Tested by

no test coverage detected