godoc2md
godoc2md copied to clipboard
Add command line flag to specify optional output file.
I run godoc2md from go generate to automatically regenerate READMEs. Since output redirection does not seem to work in //go:generate comments (probably for good reason), I need an optional -o flag to specify the output file. It's implemented so that godoc2md outputs to stdout if the flag is not specified or set to -.
Just in case someone had the same problem, it can be worked around by doing something like that:
//go:generate bash -c "godoc2md -ex -template readme.tpl >README.md"
But this is hackish and not cross-platform.