Finished
This commit is contained in:
parent
000d802e55
commit
30682f0eda
1 changed files with 16 additions and 5 deletions
|
@ -8,6 +8,7 @@ import (
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
"forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/richardrobertreitz/docudile/lib"
|
"forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/richardrobertreitz/docudile/lib"
|
||||||
)
|
)
|
||||||
|
@ -47,12 +48,22 @@ func main() {
|
||||||
log.Fatal("args: <directory> # output directory for generated files")
|
log.Fatal("args: <directory> # output directory for generated files")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cluster, err := lib.ExecNotFatal(`#!/bin/bash
|
||||||
|
kubectl config current-context
|
||||||
|
`, []string{})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal("error: ", err)
|
||||||
|
}
|
||||||
|
t := time.Now()
|
||||||
|
cluster = ", " + cluster + ", " + t.String()
|
||||||
|
|
||||||
outputDir := os.Args[1]
|
outputDir := os.Args[1]
|
||||||
if !strings.HasSuffix(outputDir, "/") {
|
if !strings.HasSuffix(outputDir, "/") {
|
||||||
outputDir += "/"
|
outputDir += "/"
|
||||||
}
|
}
|
||||||
|
|
||||||
create(false, "", outputDir)
|
create(false, "", outputDir, cluster)
|
||||||
//create(true, "pod", outputDir)
|
//create(true, "pod", outputDir)
|
||||||
//create(true, "bashes.provisioning.shell.crossplane.io", outputDir)
|
//create(true, "bashes.provisioning.shell.crossplane.io", outputDir)
|
||||||
//return
|
//return
|
||||||
|
@ -82,7 +93,7 @@ func main() {
|
||||||
go func(page string) {
|
go func(page string) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
if !strings.HasPrefix(page, "events.events.k8s.io") {
|
if !strings.HasPrefix(page, "events.events.k8s.io") {
|
||||||
create(true, page, outputDir)
|
create(true, page, outputDir, cluster)
|
||||||
fmt.Println("scaned " + page)
|
fmt.Println("scaned " + page)
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("warning, skipped " + page)
|
fmt.Println("warning, skipped " + page)
|
||||||
|
@ -92,7 +103,7 @@ func main() {
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
func create(pages bool, page string, dir string) {
|
func create(pages bool, page string, dir string, cluster string) {
|
||||||
specs := make(map[string]spec)
|
specs := make(map[string]spec)
|
||||||
arg := ""
|
arg := ""
|
||||||
|
|
||||||
|
@ -144,8 +155,8 @@ func create(pages bool, page string, dir string) {
|
||||||
fmt.Println("create index")
|
fmt.Println("create index")
|
||||||
out := createFile(dir + "index.html")
|
out := createFile(dir + "index.html")
|
||||||
outOne := createFile(dir + "onepage.html")
|
outOne := createFile(dir + "onepage.html")
|
||||||
writeFile(out, "multi page <a href=\"onepage.html\">one page</a>")
|
writeFile(out, "multi page <a href=\"onepage.html\">one page</a>"+cluster)
|
||||||
writeFile(outOne, "<a href=\"index.html\">multi page</a> one page")
|
writeFile(outOne, "<a href=\"index.html\">multi page</a> one page"+cluster)
|
||||||
writeFile(out, "<p><h3>Groups</h3>")
|
writeFile(out, "<p><h3>Groups</h3>")
|
||||||
writeFile(outOne, "<p><h3>Groups</h3>")
|
writeFile(outOne, "<p><h3>Groups</h3>")
|
||||||
last := ""
|
last := ""
|
||||||
|
|
Loading…
Reference in a new issue