Migration
This is my new public git source viewer. Source coming soon. Please contact with concerns/bugs.
Contact me
internal/modules/log.go
3a50036d96eb14462e96598fd169d1c79264ac4b
· 412 B · 24 lines
raw
| 1 | package modules |
| 2 | |
| 3 | import ( |
| 4 | "strconv" |
| 5 | |
| 6 | "gsg/internal/core" |
| 7 | ) |
| 8 | |
| 9 | func init() { core.Register("log", logMod) } |
| 10 | |
| 11 | // log: recent commits. {{ mod "log" "20" }} -- default 25, "0" = all. |
| 12 | func logMod(c *core.Ctx, args ...string) (any, error) { |
| 13 | n := 25 |
| 14 | if len(args) > 0 { |
| 15 | if v, err := strconv.Atoi(args[0]); err == nil { |
| 16 | n = v |
| 17 | } |
| 18 | } |
| 19 | rev := c.Commit |
| 20 | if rev == "" { |
| 21 | rev = c.Ref |
| 22 | } |
| 23 | return c.Repo.Log(rev, n) |
| 24 | } |