Skip to content

Commit 2ee3e46

Browse files
committed
add example to readme
1 parent 07c2cad commit 2ee3e46

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

README.md

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,41 @@
44
[![Go Reference](https://pkg.go.dev/badge/github.com/urfave/cli-docs/v3.svg)](https://pkg.go.dev/github.com/urfave/cli-docs/v3)
55
[![Go Report Card](https://goreportcard.com/badge/github.com/urfave/cli-docs/v3)](https://goreportcard.com/report/github.com/urfave/cli-docs/v3)
66

7-
urfave/cli-docs/v3 is an extended documentation library for use
8-
with urfave/cli/v3.
7+
urfave/cli-docs/v3 is an extended documentation library for use with urfave/cli/v3.
8+
9+
## Start using
10+
11+
1. Add the dependency to your project
12+
13+
```sh
14+
go get github.com/urfave/cli-docs/v3@latest
15+
```
16+
17+
2. Add it as import
18+
19+
```diff
20+
import (
21+
+ docs "github.com/urfave/cli-docs/v3"
22+
)
23+
```
24+
25+
3. Now use it e.g. to generate markdown docu from a command
26+
27+
```go
28+
func main() {
29+
app := newApp()
30+
md, err := docs.ToMarkdown(app)
31+
if err != nil {
32+
panic(err)
33+
}
34+
35+
fi, err := os.Create("cli-docs.md")
36+
if err != nil {
37+
panic(err)
38+
}
39+
defer fi.Close()
40+
if _, err := fi.WriteString("# CLI\n\n" + md); err != nil {
41+
panic(err)
42+
}
43+
}
44+
```

0 commit comments

Comments
 (0)