urfave/cli-docs/v3 is an extended documentation library for use with urfave/cli/v3.
go get github.com/urfave/cli-docs/v3@latest
import ( + docs "github.com/urfave/cli-docs/v3" )
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...] ```
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4