mirror of
https://github.com/vee1e/gittuf.git
synced 2026-09-03 03:07:10 +00:00
* Adds trailing newline to Makefile * Adds SPDX header to generation command * Adds CI check to see if docs need to be regenerated Signed-off-by: Aditya Sirish <aditya@saky.in>
37 lines
626 B
Go
37 lines
626 B
Go
//go:generate go run .
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/gittuf/gittuf/internal/cmd/root"
|
|
"github.com/spf13/cobra"
|
|
"github.com/spf13/cobra/doc"
|
|
)
|
|
|
|
var (
|
|
dir string
|
|
cmd = &cobra.Command{
|
|
Use: "gendoc",
|
|
Short: "Generate help docs",
|
|
Args: cobra.NoArgs,
|
|
RunE: func(*cobra.Command, []string) error {
|
|
return doc.GenMarkdownTree(root.New(), dir)
|
|
},
|
|
}
|
|
)
|
|
|
|
func init() {
|
|
cmd.Flags().StringVarP(&dir, "dir", "d", ".", "Path to directory in which to generate docs")
|
|
}
|
|
|
|
func main() {
|
|
if err := cmd.Execute(); err != nil {
|
|
fmt.Println(err)
|
|
os.Exit(1)
|
|
}
|
|
}
|