/
View dependency graph
Depends on
- dh-golang (dh-sequence-golang)
- golang-defaults (golang-any)
- golang-github-urfave-cli-v3 (golang-github-urfave-cli-v3-dev)
- golang-testify (golang-github-stretchr-testify-dev)
- debhelper-compat, golang-github-cpuguy83-go-md2man-v2-dev
README (full)
Welcome to urfave/cli-docs/v3
urfave/cli-docs/v3 is an extended documentation library for use with urfave/cli/v3.
Start using
- Add the dependency to your project
go get github.com/urfave/cli-docs/v3@latest
- Add it as import
import (
+ docs "github.com/urfave/cli-docs/v3"
)
- Now use it e.g. to generate markdown document from a command
package main
import (
"context"
"fmt"
"os"
docs "github.com/urfave/cli-docs/v3"
cli "github.com/urfave/cli/v3"
)
func main() {
app := &cli.Command{
Name: "greet",
Usage: "say a greeting",
Action: func(ctx context.Context, c *cli.Command) error {
fmt.Println("Greetings")
return nil
},
}
md, err := docs.ToMarkdown(app)
if err != nil {
panic(err)
}
fi, err := os.Create("cli-docs.md")
if err != nil {
panic(err)
}
defer fi.Close()
if _, err := fi.WriteString("# CLI\n\n" + md); err != nil {
panic(err)
}
}
This will create a file cli-docs.md with content:
# CLI
# NAME
greet - say a greeting
# SYNOPSIS
greet
**Usage**:
```
greet [GLOBAL OPTIONS] [command [COMMAND OPTIONS]] [ARGUMENTS...]
```
| dir | .github/ |
| dir | debian/ |
| dir | testdata/ |
| file | .gitattributes |
| file | .gitignore |
| file | .golangci.yaml |
| file | CODE_OF_CONDUCT.md |
| file | LICENSE |
| file | Makefile |
| file | README.md |
| file | docs.go |
| file | docs_test.go |
| file | go.mod |
| file | go.sum |
| file | markdown.md.gotmpl |
| file | markdown_tabular.md.gotmpl |