| 323 | } |
| 324 | |
| 325 | func 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 | |
| 349 | func helpTopicHelpFunc(w io.Writer, command *cobra.Command) { |
| 350 | fmt.Fprint(w, command.Long) |