MCPcopy Create free account
hub / github.com/Thunder-Compute/thunder-cli / wrapHelp

Function wrapHelp

cmd/help.go:13–25  ·  view source on GitHub ↗

wrapHelp wraps a custom TUI help renderer so that --json produces structured JSON and non-TTY output falls back to Cobra's default plain-text help.

(render func(cmd *cobra.Command))

Source from the content-addressed store, hash-verified

11// wrapHelp wraps a custom TUI help renderer so that --json produces structured
12// JSON and non-TTY output falls back to Cobra's default plain-text help.
13func wrapHelp(render func(cmd *cobra.Command)) func(*cobra.Command, []string) {
14 return func(cmd *cobra.Command, args []string) {
15 if JSONOutput {
16 printJSONHelp(cmd)
17 return
18 }
19 if !termx.IsTerminal(os.Stdout.Fd()) {
20 printDefaultHelp(cmd)
21 return
22 }
23 render(cmd)
24 }
25}
26
27type jsonFlag struct {
28 Name string `json:"name"`

Callers 15

initFunction · 0.85
initFunction · 0.85
initFunction · 0.85
initFunction · 0.85
initFunction · 0.85
initFunction · 0.85
initFunction · 0.85
initFunction · 0.85
initFunction · 0.85
initFunction · 0.85
initFunction · 0.85
initFunction · 0.85

Calls 2

printJSONHelpFunction · 0.85
printDefaultHelpFunction · 0.85

Tested by

no test coverage detected