diff --git a/main.go b/main.go index b831dab..658af0b 100644 --- a/main.go +++ b/main.go @@ -26,82 +26,6 @@ const EMPTY = "4b825dc642cb6eb9a060e54bf8d69288fbee4904" //go:embed page.html.tmpl var tpl string -// Data is the generic content map passed on to the page template. -type Data map[string]interface{} -type page struct { - Data - Base string - Stylesheet string - Title string -} - -type branch struct { - Commits []commit - Name string - Project string -} - -func (b branch) String() string { - return b.Name -} - -type diff struct { - Body string - Commit commit - Parent string -} - -type overview struct { - Body string - Hash string - Parent string -} - -type hash struct { - Hash string - Short string -} - -func (h hash) String() string { - return h.Hash -} - -type object struct { - Hash string - Path string -} - -func (o object) Dir() string { - return filepath.Join(o.Hash[0:2], o.Hash[2:]) -} - -type show struct { - Body string - Bin bool - Lines []int - object -} - -type commit struct { - Branch string - Body string - Abbr string - History []overview - Parents []string - Hash string - Author author - Date time.Time - Project string - Tree []object - Types map[string]bool - Subject string -} - -type author struct { - Email string - Name string -} - func init() { // Override default usage output. flag.Usage = func() { diff --git a/types.go b/types.go new file mode 100644 index 0000000..363bebf --- /dev/null +++ b/types.go @@ -0,0 +1,76 @@ +// Data is the generic content map passed on to the page template. +type Data map[string]interface{} +type page struct { + Data + Base string + Stylesheet string + Title string +} + +type branch struct { + Commits []commit + Name string + Project string +} + +func (b branch) String() string { + return b.Name +} + +type diff struct { + Body string + Commit commit + Parent string +} + +type overview struct { + Body string + Hash string + Parent string +} + +type hash struct { + Hash string + Short string +} + +func (h hash) String() string { + return h.Hash +} + +type object struct { + Hash string + Path string +} + +func (o object) Dir() string { + return filepath.Join(o.Hash[0:2], o.Hash[2:]) +} + +type show struct { + Body string + Bin bool + Lines []int + object +} + +type commit struct { + Branch string + Body string + Abbr string + History []overview + Parents []string + Hash string + Author author + Date time.Time + Project string + Tree []object + Types map[string]bool + Subject string +} + +type author struct { + Email string + Name string +} +
home › develop › 418f38d › 542911b