Skip to content

Commit

Permalink
add suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
6543 committed Jul 14, 2024
1 parent 944ca25 commit 71d54df
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,26 @@ urfave/cli-docs/v3 is an extended documentation library for use with urfave/cli/
3. Now use it e.g. to generate markdown document from a command

```go
package main

import (
"fmt"
"os"

docs "github.com/urfave/cli-docs/v3"
cli "github.com/urfave/cli/v3"
)

func main() {
app := newApp()
app := &cli.Command{
Name: "greet",
Usage: "say a greeting",
Action: func(c *cli.Context) error {
fmt.Println("Greetings")
return nil
},
}

md, err := docs.ToMarkdown(app)
if err != nil {
panic(err)
Expand All @@ -42,3 +60,23 @@ func main() {
}
}
```

This will create a file `cli-docs.md` with content:

````md
# CLI

# NAME

greet - say a greeting

# SYNOPSIS

greet

**Usage**:

```
greet [GLOBAL OPTIONS] [command [COMMAND OPTIONS]] [ARGUMENTS...]
```
````

0 comments on commit 71d54df

Please sign in to comment.