| 14 | } |
| 15 | |
| 16 | func newManCmd() *manCmd { |
| 17 | root := &manCmd{} |
| 18 | cmd := &cobra.Command{ |
| 19 | Use: "man", |
| 20 | Short: "Generates tt's command line manpages", |
| 21 | SilenceUsage: true, |
| 22 | DisableFlagsInUseLine: true, |
| 23 | Hidden: true, |
| 24 | Args: cobra.NoArgs, |
| 25 | RunE: func(cmd *cobra.Command, args []string) error { |
| 26 | manPage, err := mcobra.NewManPage(1, root.cmd.Root()) |
| 27 | if err != nil { |
| 28 | return err |
| 29 | } |
| 30 | |
| 31 | _, err = fmt.Fprint(os.Stdout, manPage.Build(roff.NewDocument())) |
| 32 | return err |
| 33 | }, |
| 34 | } |
| 35 | |
| 36 | root.cmd = cmd |
| 37 | return root |
| 38 | } |