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

Function NewCmdHelpTopic

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

Source from the content-addressed store, hash-verified

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