GenManTree will generate a man page for this command and all descendants in the directory given. The header may be nil. This function may not work correctly if your command names have `-` in them. If you have `cmd` with two subcmds, `sub` and `sub-third`, and `sub` has a subcommand called `third` it
(cmd *cobra.Command, dir string)
| 24 | // subcmds, `sub` and `sub-third`, and `sub` has a subcommand called `third` |
| 25 | // it is undefined which help output will be in the file `cmd-sub-third.1`. |
| 26 | func GenManTree(cmd *cobra.Command, dir string) error { |
| 27 | if os.Getenv("GH_COBRA") != "" { |
| 28 | return doc.GenManTreeFromOpts(cmd, doc.GenManTreeOptions{ |
| 29 | Path: dir, |
| 30 | CommandSeparator: "-", |
| 31 | }) |
| 32 | } |
| 33 | return genManTreeFromOpts(cmd, GenManTreeOptions{ |
| 34 | Path: dir, |
| 35 | CommandSeparator: "-", |
| 36 | }) |
| 37 | } |
| 38 | |
| 39 | // genManTreeFromOpts generates a man page for the command and all descendants. |
| 40 | // The pages are written to the opts.Path directory. |