2020-11-17 05:41:34 +00:00
|
|
|
// +build docs
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
2020-11-19 05:08:49 +00:00
|
|
|
"regexp"
|
2020-11-17 05:41:34 +00:00
|
|
|
"strings"
|
|
|
|
|
|
|
|
"go.jolheiser.com/tmpl/cmd"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
app := cmd.NewApp()
|
|
|
|
|
2020-11-22 05:25:24 +00:00
|
|
|
fi, err := os.Create("CLI.md")
|
2020-11-17 05:41:34 +00:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
defer fi.Close()
|
|
|
|
|
|
|
|
md, err := app.ToMarkdown()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
// CLI ToMarkdown issue related to man-pages
|
|
|
|
md = md[strings.Index(md, "#"):]
|
|
|
|
|
2020-11-19 05:08:49 +00:00
|
|
|
// CLI is using real default instead of DefaultText
|
2021-01-03 03:29:37 +00:00
|
|
|
md = regexp.MustCompile(`[\/\\:\w]+\.tmpl`).ReplaceAllString(md, "~/.tmpl")
|
2020-11-19 05:08:49 +00:00
|
|
|
|
2020-11-17 05:41:34 +00:00
|
|
|
if _, err := fi.WriteString(md); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|