mirror of
https://github.com/apricote/hcloud-upload-image.git
synced 2026-01-13 21:31:03 +00:00
docs: add generated CLI help output to repo
This commit is contained in:
parent
6d8d2a02df
commit
3f5ab06409
11 changed files with 188 additions and 18 deletions
35
scripts/cli-help-pages.go
Normal file
35
scripts/cli-help-pages.go
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
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/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)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue