aboutsummaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
authorEddy Pedroni <epedroni@pm.me>2025-04-08 17:01:55 +0200
committerEddy Pedroni <epedroni@pm.me>2025-04-08 17:02:46 +0200
commit83d175b7b069bc3bbc0d600c2fab4d082e04b521 (patch)
tree9d1b7975ad16f7d5433285d3fab0a7cc38d24564 /main.go
parent38b40d8c5a8915716b3aa46aac4a0a84d0113b25 (diff)
Python implementation with better multi-entry page support
Diffstat (limited to 'main.go')
-rw-r--r--main.go63
1 files changed, 0 insertions, 63 deletions
diff --git a/main.go b/main.go
deleted file mode 100644
index 5b444a8..0000000
--- a/main.go
+++ /dev/null
@@ -1,63 +0,0 @@
-package main
-
-import (
- "fmt"
- "github.com/otiai10/copy"
- "os"
- "path/filepath"
-)
-
-func main() {
- // show usage if config file is missing
- if len(os.Args) < 2 {
- fmt.Println("Usage: godocs <config>")
- os.Exit(1)
- }
-
- // read config file specified in the command line
- cfg := readConfig(os.Args[1])
-
- // create temporary target directory
- tmp := createTempDir("godocs")
- defer os.RemoveAll(tmp)
-
- // gather all sites in docsRoot
- sites := getSites(cfg)
-
- for _, site := range sites {
- // collect all entries
- entries := findEntries(site.sourcePath)
-
- // render all entries
- createPageMap(&site, entries)
-
- // create navigation item slice
- createNavSlice(&site, cfg)
-
- // output the site
- generateSite(site, cfg, tmp)
- }
-
- // copy CSS file to generation directory
- err := copy.Copy(cfg.CssFile, filepath.Join(tmp, "style.css"))
- if err != nil {
- panic(err)
- }
-
- // if we are here, generation succeeded, so we move the generated content to the target directory
- err = os.RemoveAll(cfg.TargetDir)
- if err != nil {
- panic(err)
- }
-
- err = os.Rename(tmp, cfg.TargetDir)
- if err != nil {
- panic(err)
- }
-
- // fix because for some reason the generated directory ends up with the wrong permissions
- err = os.Chmod(cfg.TargetDir, 0755)
- if err != nil {
- panic(err)
- }
-}