gshr
git static host repo -- generates static html for repos
git clone https://git.vogt.world/gshr.git
Log | Files | README.md | LICENSE
← Commit log
commit
message
Misc renaming
author
Ben Vogt <[email protected]>
date
2023-04-05 15:23:54
stats
6 file(s) changed, 11 insertions(+), 12 deletions(-)
files
commit.go
file.go
files.go
index.go
log.go
main.go
  1diff --git a/commit.go b/commit.go
  2index ef087ad..ad7281e 100644
  3--- a/commit.go
  4+++ b/commit.go
  5@@ -24,7 +24,7 @@ type CommitPage struct {
  6 	DiffContent     template.HTML
  7 }
  8 
  9-func (c *CommitPage) Render(t *template.Template) {
 10+func (c *CommitPage) RenderPage(t *template.Template) {
 11 	debug("commit %v %v", c.RepoData.Name, c.Hash)
 12 	err := os.MkdirAll(path.Join(args.OutputDir, c.RepoData.Name, "commit", c.Hash), 0755)
 13 	checkErr(err)
 14@@ -98,7 +98,7 @@ func RenderAllCommitPages(data RepoData, r *git.Repository) {
 15 			LinesDeleted:    deleted,
 16 			FilesChanged:    filesChanged,
 17 			DiffContent:     diffContent,
 18-		}).Render(t)
 19+		}).RenderPage(t)
 20 		return nil
 21 	})
 22 	checkErr(err)
 23diff --git a/file.go b/file.go
 24index ab3a815..bde7265 100644
 25--- a/file.go
 26+++ b/file.go
 27@@ -22,7 +22,7 @@ type FilePage struct {
 28 	Content        template.HTML
 29 }
 30 
 31-func (f *FilePage) Render(t *template.Template) {
 32+func (f *FilePage) RenderPage(t *template.Template) {
 33 	debug("file %v%v", f.RepoData.Name, f.Name)
 34 	err := os.MkdirAll(f.DestinationDir, 0775)
 35 	checkErr(err)
 36@@ -64,7 +64,7 @@ func RenderSingleFilePages(data RepoData) {
 37 				Origin:         filename,
 38 				Destination:    outputName,
 39 				DestinationDir: path.Join(args.OutputDir, data.Name, "files", partialPath),
 40-			}).Render(t)
 41+			}).RenderPage(t)
 42 		}
 43 		return nil
 44 	})
 45diff --git a/files.go b/files.go
 46index d832748..b63208b 100644
 47--- a/files.go
 48+++ b/files.go
 49@@ -22,7 +22,7 @@ type FilesPage struct {
 50 	Files    []FileOverview
 51 }
 52 
 53-func (f *FilesPage) Render(t *template.Template) {
 54+func (f *FilesPage) RenderPage(t *template.Template) {
 55 	debug("file page for '%v'", f.RepoData.Name)
 56 	output, err := os.Create(path.Join(args.OutputDir, f.RepoData.Name, "files.html"))
 57 	checkErr(err)
 58@@ -59,5 +59,5 @@ func RenderAllFilesPage(data RepoData) {
 59 		RepoData: data,
 60 		Files:    files,
 61 	}
 62-	index.Render(t)
 63+	index.RenderPage(t)
 64 }
 65diff --git a/index.go b/index.go
 66index 2dae5a2..333b99c 100644
 67--- a/index.go
 68+++ b/index.go
 69@@ -12,7 +12,7 @@ type IndexPage struct {
 70 	Repos    []RepoData
 71 }
 72 
 73-func (l *IndexPage) Render(t *template.Template) {
 74+func (l *IndexPage) RenderPage(t *template.Template) {
 75 	debug("index for '%v'", l.SiteName)
 76 	output, err := os.Create(path.Join(args.OutputDir, "index.html"))
 77 	checkErr(err)
 78@@ -27,5 +27,5 @@ func RenderIndexPage(repos []RepoData) {
 79 		BaseURL:  config.BaseURL,
 80 		SiteName: config.SiteName,
 81 		Repos:    repos,
 82-	}).Render(t)
 83+	}).RenderPage(t)
 84 }
 85diff --git a/log.go b/log.go
 86index 359b140..3a80868 100644
 87--- a/log.go
 88+++ b/log.go
 89@@ -26,7 +26,7 @@ type LogPage struct {
 90 	Commits    []LogPageCommit
 91 }
 92 
 93-func (l *LogPage) Render(t *template.Template) {
 94+func (l *LogPage) RenderPage(t *template.Template) {
 95 	debug("log page for '%v'", l.RepoData.Name)
 96 	output, err := os.Create(path.Join(args.OutputDir, l.RepoData.Name, "log.html"))
 97 	checkErr(err)
 98@@ -67,5 +67,5 @@ func RenderLogPage(data RepoData, r *git.Repository) {
 99 	(&LogPage{
100 		RepoData: data,
101 		Commits:  commits,
102-	}).Render(t)
103+	}).RenderPage(t)
104 }
105diff --git a/main.go b/main.go
106index c14bdda..d8808f1 100644
107--- a/main.go
108+++ b/main.go
109@@ -47,9 +47,9 @@ func Init() {
110 	args = DefaultCmdArgs()
111 	settings = DefaultSettings()
112 	flag.StringVar(&args.ConfigFile, "config", "", "Config file.")
113-	flag.BoolVar(&args.Silent, "silent", false, "Run in silent mode.")
114 	flag.StringVar(&args.OutputDir, "output", "", "Dir of output.")
115 	flag.StringVar(&args.CloneDir, "clone", "", "Dir to clone into. Default is /tmp/${rand}")
116+	flag.BoolVar(&args.Silent, "silent", false, "Run in silent mode.")
117 	flag.Parse()
118 
119 	if args.CloneDir == "" {