MCPcopy Create free account
hub / github.com/cli/cli / NewCmdHelpTopic

Function NewCmdHelpTopic

pkg/cmd/root/help_topic.go:328–350  ·  view source on GitHub ↗
(ios *iostreams.IOStreams, ht helpTopic)

Source from the content-addressed store, hash-verified

326}
327
328func NewCmdHelpTopic(ios *iostreams.IOStreams, ht helpTopic) *cobra.Command {
329 cmd := &cobra.Command{
330 Use: ht.name,
331 Short: ht.short,
332 Long: ht.long,
333 Example: ht.example,
334 Hidden: true,
335 Annotations: map[string]string{
336 "markdown:generate": "true",
337 "markdown:basename": "gh_help_" + ht.name,
338 },
339 }
340
341 cmd.SetUsageFunc(func(c *cobra.Command) error {
342 return helpTopicUsageFunc(ios.ErrOut, c)
343 })
344
345 cmd.SetHelpFunc(func(c *cobra.Command, _ []string) {
346 helpTopicHelpFunc(ios.Out, c)
347 })
348
349 return cmd
350}
351
352func helpTopicHelpFunc(w io.Writer, command *cobra.Command) {
353 fmt.Fprint(w, command.Long)

Callers 2

NewCmdRootFunction · 0.85
TestCmdHelpTopicFunction · 0.85

Calls 2

helpTopicUsageFuncFunction · 0.85
helpTopicHelpFuncFunction · 0.85

Tested by 1

TestCmdHelpTopicFunction · 0.68