README.md

 1# mango-pflag
 2
 3[![Latest Release](https://img.shields.io/github/release/muesli/mango-pflag.svg)](https://github.com/muesli/mango-pflag/releases)
 4[![Build Status](https://github.com/muesli/mango-pflag/workflows/build/badge.svg)](https://github.com/muesli/mango-pflag/actions)
 5[![Go ReportCard](https://goreportcard.com/badge/muesli/mango-pflag)](https://goreportcard.com/report/muesli/mango-pflag)
 6[![GoDoc](https://godoc.org/github.com/golang/gddo?status.svg)](https://pkg.go.dev/github.com/muesli/mango-pflag)
 7
 8pflag adapter for [mango](https://github.com/muesli/mango).
 9
10## Example
11
12```go
13import (
14    "fmt"
15
16    "github.com/muesli/mango"
17    mpflag "github.com/muesli/mango-pflag"
18    "github.com/muesli/roff"
19    flag "github.com/spf13/pflag"
20)
21
22func main() {
23    flag.Parse()
24
25    manPage := mango.NewManPage(1, "mango", "a man-page generator").
26        WithLongDescription("mango is a man-page generator for Go.").
27        WithSection("Copyright", "(C) 2022 Christian Muehlhaeuser.\n"+
28            "Released under MIT license.")
29
30    flag.VisitAll(mpflag.PFlagVisitor(manPage))
31    fmt.Println(manPage.Build(roff.NewDocument()))
32}
33```