repos / pgit

static site generator for git
git clone https://github.com/picosh/pgit.git

commit
73638da
parent
d409522
author
Eric Bower
date
2023-08-10 16:38:26 +0000 UTC
chore: remove relative dates
3 files changed,  +9, -8
M go.mod
M go.sum
M go.mod
+0, -1
1@@ -6,7 +6,6 @@ require (
2 	github.com/alecthomas/chroma v0.10.0
3 	github.com/dustin/go-humanize v1.0.0
4 	github.com/gogs/git-module v1.6.0
5-	github.com/mergestat/timediff v0.0.3
6 	go.uber.org/zap v1.25.0
7 )
8 
M go.sum
+0, -2
1@@ -13,8 +13,6 @@ github.com/gogs/git-module v1.6.0 h1:71GdRM9/pFxGgSUz8t2DKmm3RYuHUnTjsOuFInJXnkM
2 github.com/gogs/git-module v1.6.0/go.mod h1:8jFYhDxLUwEOhM2709l2CJXmoIIslobU1xszpT0NcAI=
3 github.com/mcuadros/go-version v0.0.0-20190308113854-92cdf37c5b75 h1:Pijfgr7ZuvX7QIQiEwLdRVr3RoMG+i0SbBO1Qu+7yVk=
4 github.com/mcuadros/go-version v0.0.0-20190308113854-92cdf37c5b75/go.mod h1:76rfSfYPWj01Z85hUf/ituArm797mNKcvINh1OlsZKo=
5-github.com/mergestat/timediff v0.0.3 h1:ucCNh4/ZrTPjFZ081PccNbhx9spymCJkFxSzgVuPU+Y=
6-github.com/mergestat/timediff v0.0.3/go.mod h1:yvMUaRu2oetc+9IbPLYBJviz6sA7xz8OXMDfhBl7YSI=
7 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
8 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
9 github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
M main.go
+9, -5
 1@@ -13,6 +13,7 @@ import (
 2 	"path/filepath"
 3 	"sort"
 4 	"strings"
 5+	"time"
 6 	"unicode/utf8"
 7 
 8 	"github.com/alecthomas/chroma"
 9@@ -21,7 +22,6 @@ import (
10 	"github.com/alecthomas/chroma/styles"
11 	"github.com/dustin/go-humanize"
12 	git "github.com/gogs/git-module"
13-	"github.com/mergestat/timediff"
14 	"go.uber.org/zap"
15 )
16 
17@@ -333,8 +333,8 @@ func (c *Config) writeHtml(writeData *WriteData) {
18 
19 func (c *Config) copyStatic(dst string, data []byte) {
20 	c.Logger.Infof("writing (%s)", dst)
21-    err := ioutil.WriteFile(dst, data, 0755)
22-    bail(err)
23+	err := ioutil.WriteFile(dst, data, 0755)
24+	bail(err)
25 }
26 
27 func (c *Config) writeRootSummary(data *PageData, readme template.HTML) {
28@@ -692,7 +692,7 @@ func (c *Config) writeRevision(repo *git.Repository, pageData *PageData, refs []
29 			ShortID:    getShortID(commit.ID.String()),
30 			SummaryStr: commit.Summary(),
31 			AuthorStr:  commit.Author.Name,
32-			WhenStr:    timediff.TimeDiff(commit.Author.When),
33+			WhenStr:    commit.Author.When.Format(time.RFC822),
34 			Commit:     commit,
35 			Refs:       tags,
36 		})
37@@ -723,7 +723,7 @@ func (c *Config) writeRevision(repo *git.Repository, pageData *PageData, refs []
38 			}
39 			entry.CommitURL = c.getCommitURL(lc.ID.String())
40 			entry.Summary = lc.Summary()
41-			entry.When = timediff.TimeDiff(lc.Author.When)
42+			entry.When = lc.Author.When.Format(time.RFC822)
43 		}
44 		entry.URL = template.URL(filepath.Join(
45 			"/",
46@@ -757,6 +757,8 @@ func main() {
47 	var themeFlag = flag.String("theme", "dracula", "theme to use for site")
48 	var labelFlag = flag.String("label", "", "pretty name for the subdir where we create the repo, default is last folder in --repo")
49 	var assetFlag = flag.Bool("assets", false, "copy static assets to --out")
50+	var cloneFlag = flag.String("clone-url", "", "git clone URL")
51+	var descFlag = flag.String("desc", "", "description for repo")
52 
53 	flag.Parse()
54 
55@@ -792,6 +794,8 @@ func main() {
56 		Revs:     revs,
57 		Theme:    theme,
58 		Logger:   logger,
59+		CloneURL: template.URL(*cloneFlag),
60+		Desc:     *descFlag,
61 	}
62 	config.Logger.Infof("%+v", config)
63