hcloud-upload-image/scripts/cli-help-pages.go
Julian Tölle d144b85e3d
feat: docs website (#80)
Deploy the documentation to GitHub Pages using `mdbook` and a little
more content for it. Can be visited at https://apricote.github.io/hcloud-upload-image.
2025-05-04 02:18:47 +02:00

36 lines
677 B
Go

package main
import (
"fmt"
"os"
"github.com/spf13/cobra/doc"
"github.com/apricote/hcloud-upload-image/cmd"
)
func run() error {
// Define the directory where the docs will be generated
dir := "docs/reference/cli"
// Ensure the directory exists
if err := os.MkdirAll(dir, 0755); err != nil {
return fmt.Errorf("error creating docs directory: %v", err)
}
// Generate the docs
if err := doc.GenMarkdownTree(cmd.RootCmd, dir); err != nil {
return fmt.Errorf("error generating docs: %v", err)
}
fmt.Println("Docs generated successfully in", dir)
return nil
}
func main() {
if err := run(); err != nil {
fmt.Printf("Error: %v\n", err)
os.Exit(1)
}
}