1# mango-cobra
2
3[](https://github.com/muesli/mango-cobra/releases)
4[](https://github.com/muesli/mango-cobra/actions)
5[](https://goreportcard.com/report/muesli/mango-cobra)
6[](https://pkg.go.dev/github.com/muesli/mango-cobra)
7
8cobra adapter for [mango](https://github.com/muesli/mango).
9
10## Example
11
12```go
13import (
14 "fmt"
15
16 mcobra "github.com/muesli/mango-cobra"
17 "github.com/muesli/roff"
18 "github.com/spf13/cobra"
19)
20
21var (
22 rootCmd = &cobra.Command{
23 Use: "mango",
24 Short: "A man-page generator",
25 }
26)
27
28func main() {
29 manPage, err := mcobra.NewManPage(1, rootCmd)
30 if err != nil {
31 panic(err)
32 }
33
34 manPage = manPage.WithSection("Copyright", "(C) 2022 Christian Muehlhaeuser.\n"+
35 "Released under MIT license.")
36
37 fmt.Println(manPage.Build(roff.NewDocument()))
38}
39```