Commit 73638da

Eric Bower  ·  2023-08-10 12:38:26 -0400 EDT
parent d409522
chore: remove relative dates
3 files changed,  +9, -8
M go.mod
M go.sum
M go.mod
+0, -1
......@@ -6,7 +6,6 @@ require (
66 github.com/alecthomas/chroma v0.10.0
77 github.com/dustin/go-humanize v1.0.0
88 github.com/gogs/git-module v1.6.0
9- github.com/mergestat/timediff v0.0.3
109 go.uber.org/zap v1.25.0
1110 )
1211
M go.sum
+0, -2
......@@ -13,8 +13,6 @@ github.com/gogs/git-module v1.6.0 h1:71GdRM9/pFxGgSUz8t2DKmm3RYuHUnTjsOuFInJXnkM
1313 github.com/gogs/git-module v1.6.0/go.mod h1:8jFYhDxLUwEOhM2709l2CJXmoIIslobU1xszpT0NcAI=
1414 github.com/mcuadros/go-version v0.0.0-20190308113854-92cdf37c5b75 h1:Pijfgr7ZuvX7QIQiEwLdRVr3RoMG+i0SbBO1Qu+7yVk=
1515 github.com/mcuadros/go-version v0.0.0-20190308113854-92cdf37c5b75/go.mod h1:76rfSfYPWj01Z85hUf/ituArm797mNKcvINh1OlsZKo=
16-github.com/mergestat/timediff v0.0.3 h1:ucCNh4/ZrTPjFZ081PccNbhx9spymCJkFxSzgVuPU+Y=
17-github.com/mergestat/timediff v0.0.3/go.mod h1:yvMUaRu2oetc+9IbPLYBJviz6sA7xz8OXMDfhBl7YSI=
1816 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
1917 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
2018 github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+9, -5
......@@ -13,6 +13,7 @@ import (
1313 "path/filepath"
1414 "sort"
1515 "strings"
16+ "time"
1617 "unicode/utf8"
1718
1819 "github.com/alecthomas/chroma"
......@@ -21,7 +22,6 @@ import (
2122 "github.com/alecthomas/chroma/styles"
2223 "github.com/dustin/go-humanize"
2324 git "github.com/gogs/git-module"
24- "github.com/mergestat/timediff"
2525 "go.uber.org/zap"
2626 )
2727
......@@ -333,8 +333,8 @@ func (c *Config) writeHtml(writeData *WriteData) {
333333
334334 func (c *Config) copyStatic(dst string, data []byte) {
335335 c.Logger.Infof("writing (%s)", dst)
336- err := ioutil.WriteFile(dst, data, 0755)
337- bail(err)
336+ err := ioutil.WriteFile(dst, data, 0755)
337+ bail(err)
338338 }
339339
340340 func (c *Config) writeRootSummary(data *PageData, readme template.HTML) {
......@@ -692,7 +692,7 @@ func (c *Config) writeRevision(repo *git.Repository, pageData *PageData, refs []
692692 ShortID: getShortID(commit.ID.String()),
693693 SummaryStr: commit.Summary(),
694694 AuthorStr: commit.Author.Name,
695- WhenStr: timediff.TimeDiff(commit.Author.When),
695+ WhenStr: commit.Author.When.Format(time.RFC822),
696696 Commit: commit,
697697 Refs: tags,
698698 })
......@@ -723,7 +723,7 @@ func (c *Config) writeRevision(repo *git.Repository, pageData *PageData, refs []
723723 }
724724 entry.CommitURL = c.getCommitURL(lc.ID.String())
725725 entry.Summary = lc.Summary()
726- entry.When = timediff.TimeDiff(lc.Author.When)
726+ entry.When = lc.Author.When.Format(time.RFC822)
727727 }
728728 entry.URL = template.URL(filepath.Join(
729729 "/",
......@@ -757,6 +757,8 @@ func main() {
757757 var themeFlag = flag.String("theme", "dracula", "theme to use for site")
758758 var labelFlag = flag.String("label", "", "pretty name for the subdir where we create the repo, default is last folder in --repo")
759759 var assetFlag = flag.Bool("assets", false, "copy static assets to --out")
760+ var cloneFlag = flag.String("clone-url", "", "git clone URL")
761+ var descFlag = flag.String("desc", "", "description for repo")
760762
761763 flag.Parse()
762764
......@@ -792,6 +794,8 @@ func main() {
792794 Revs: revs,
793795 Theme: theme,
794796 Logger: logger,
797+ CloneURL: template.URL(*cloneFlag),
798+ Desc: *descFlag,
795799 }
796800 config.Logger.Infof("%+v", config)
797801