40 lines
798 B
Go
40 lines
798 B
Go
package tools
|
|
|
|
import (
|
|
"code.squareroundforest.org/arpio/docreflect/generate"
|
|
"fmt"
|
|
"io"
|
|
)
|
|
|
|
type ManOptions struct {
|
|
DateString string
|
|
Version string
|
|
}
|
|
|
|
type MarkdownOptions struct {
|
|
Level int
|
|
}
|
|
|
|
func Docreflect(out io.Writer, packageName string, gopaths ...string) error {
|
|
return generate.GenerateRegistry(out, packageName, gopaths...)
|
|
}
|
|
|
|
func Man(out io.Writer, o ManOptions, commandDir string) error {
|
|
return execCommandDir(
|
|
out,
|
|
commandDir,
|
|
"_wandgenerate=man",
|
|
fmt.Sprintf("_wandgeneratedate=%s", o.DateString),
|
|
fmt.Sprintf("_wandgenerateversion=%s", o.Version),
|
|
)
|
|
}
|
|
|
|
func Markdown(out io.Writer, o MarkdownOptions, commandDir string) error {
|
|
return execCommandDir(
|
|
out,
|
|
commandDir,
|
|
"_wandgenerate=markdown",
|
|
fmt.Sprintf("_wandmarkdownlevel=%d", o.Level),
|
|
)
|
|
}
|