MCPcopy Create free account
hub / github.com/basecamp/hey-cli / customHelpFunc

Function customHelpFunc

internal/cmd/help.go:40–52  ·  view source on GitHub ↗

customHelpFunc returns a help function that renders styled help for all commands: agent JSON when --agent is set, curated categories for root, and a consistent styled layout for every subcommand.

(defaultHelp func(*cobra.Command, []string))

Source from the content-addressed store, hash-verified

38// commands: agent JSON when --agent is set, curated categories for root,
39// and a consistent styled layout for every subcommand.
40func customHelpFunc(defaultHelp func(*cobra.Command, []string)) func(*cobra.Command, []string) {
41 return func(cmd *cobra.Command, args []string) {
42 if agentFlag {
43 printAgentHelp(cmd)
44 return
45 }
46 if cmd == cmd.Root() {
47 renderRootHelp(cmd.OutOrStdout(), cmd)
48 return
49 }
50 renderCommandHelp(cmd)
51 }
52}
53
54func renderRootHelp(w io.Writer, cmd *cobra.Command) {
55 var b strings.Builder

Callers 1

newRootCmdFunction · 0.85

Calls 3

printAgentHelpFunction · 0.85
renderRootHelpFunction · 0.85
renderCommandHelpFunction · 0.85

Tested by

no test coverage detected