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

Function NewCmdHelpTopic

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

Source from the content-addressed store, hash-verified

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