MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / cmdhelpOptions

Function cmdhelpOptions

cmd/pad/help_cmdhelp.go:129–141  ·  view source on GitHub ↗

cmdhelpOptions builds the Options struct shared by JSON and markdown emitters. Centralized so both formats see the same dynamic resolver, version metadata, and homepage. Binary is derived from the root command's name rather than hardcoded so tests constructing a synthetic root (e.g. "padtest") get

(target *cobra.Command, depth int, all bool)

Source from the content-addressed store, hash-verified

127// so tests constructing a synthetic root (e.g. "padtest") get a
128// document keyed to that name.
129func cmdhelpOptions(target *cobra.Command, depth int, all bool) cmdhelp.Options {
130 maxDepth := depth
131 if all {
132 maxDepth = -1
133 }
134 return cmdhelp.Options{
135 Binary: target.Root().Name(),
136 Version: fullVersion(),
137 Homepage: padHomepage,
138 MaxDepth: maxDepth,
139 Resolver: newDynamicResolver(),
140 }
141}
142
143// emitCmdhelpJSON walks the cobra command tree below `target` and emits
144// a cmdhelp v0.1 JSON document matching schema/cmdhelp.schema.json.

Callers 2

emitCmdhelpJSONFunction · 0.85
emitCmdhelpMarkdownFunction · 0.85

Calls 2

fullVersionFunction · 0.85
newDynamicResolverFunction · 0.85

Tested by

no test coverage detected