Better markdown docs generation
tarampampam opened this issue · comments
Hi there, and thanks for your project! He is really awesome!
I could ask what you think about the improvement of markdown CLI docs generation - very often I use the following, hm... "addon" (which was crafted by me) to automatically update the CLI usage section in the project readme file: gh.tarampamp.am/urfave-cli-docs. In a few words, it allows using go generate ./...
to update a section in the readme file (between the tags):
<!--GENERATED:CLI_DOCS-->
<!--/GENERATED:CLI_DOCS-->
With something like that:
From the sources:
import (
"fmt"
"github.com/urfave/cli/v2"
)
func NewApp() *cli.App {
return &cli.App{
Name: "example",
Usage: "Example CLI application",
Commands: []*cli.Command{
{
Name: "hello",
Aliases: []string{"hi"},
Usage: "Prints hello",
Action: func(c *cli.Context) error {
fmt.Printf("Hello, %s!", c.String("name"))
return nil
},
Flags: []cli.Flag{
&cli.StringFlag{
Name: "name",
Value: "stranger",
Usage: "Just a name",
Aliases: []string{"n"},
EnvVars: []string{"NAME"},
},
},
},
},
}
}
And I found this very useful, and probably other users of this library will find this useful and for them. Should I make PR with appropriate changes to this project, or not?
@tarampampam Please submit a PR . Thank you so much