MCPcopy
hub / github.com/cli/cli / NewCmdHelpTopic

Function NewCmdHelpTopic

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

Source from the content-addressed store, hash-verified

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