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

Method IsAdditionalHelpTopicCommand

command.go:1628–1643  ·  view source on GitHub ↗

IsAdditionalHelpTopicCommand determines if a command is an additional help topic command; additional help topic command is determined by the fact that it is NOT runnable/hidden/deprecated, and has no sub commands that are runnable/hidden/deprecated. Concrete example: https://github.com/spf13/cobra/i

()

Source from the content-addressed store, hash-verified

1626// are runnable/hidden/deprecated.
1627// Concrete example: https://github.com/spf13/cobra/issues/393#issuecomment-282741924.
1628func (c *Command) IsAdditionalHelpTopicCommand() bool {
1629 // if a command is runnable, deprecated, or hidden it is not a 'help' command
1630 if c.Runnable() || len(c.Deprecated) != 0 || c.Hidden {
1631 return false
1632 }
1633
1634 // if any non-help sub commands are found, the command is not a 'help' command
1635 for _, sub := range c.commands {
1636 if !sub.IsAdditionalHelpTopicCommand() {
1637 return false
1638 }
1639 }
1640
1641 // the command either has no sub commands, or no non-help sub commands
1642 return true
1643}
1644
1645// HasHelpSubCommands determines if a command has any available 'help' sub commands
1646// that need to be shown in the usage/help default template under 'additional help

Callers 11

HasHelpSubCommandsMethod · 0.80
defaultUsageFuncFunction · 0.80
GenManTreeFromOptsFunction · 0.80
genManFunction · 0.80
GenYamlTreeCustomFunction · 0.80
GenYamlCustomFunction · 0.80
GenReSTCustomFunction · 0.80
GenReSTTreeCustomFunction · 0.80
hasSeeAlsoFunction · 0.80
GenMarkdownCustomFunction · 0.80
GenMarkdownTreeCustomFunction · 0.80

Calls 1

RunnableMethod · 0.95

Tested by

no test coverage detected