aboutsummaryrefslogtreecommitdiffstats
path: root/bug/snapshot.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-07-15 01:43:20 +0200
committerMichael Muré <batolettre@gmail.com>2018-07-15 01:43:20 +0200
commit1e4562e9991df974a959774d3a919ed190a4351b (patch)
tree690da6e29ac5fc3ca5599087fe97d6950d7e623d /bug/snapshot.go
parentdfefba09ee706d2804969dc751c57a77f0d77bbf (diff)
downloadgit-bug-1e4562e9991df974a959774d3a919ed190a4351b.tar.gz
ls: better output
Diffstat (limited to 'bug/snapshot.go')
-rw-r--r--bug/snapshot.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/bug/snapshot.go b/bug/snapshot.go
index 8828c337..9b9acf87 100644
--- a/bug/snapshot.go
+++ b/bug/snapshot.go
@@ -1,8 +1,26 @@
package bug
+import (
+ "fmt"
+ "time"
+)
+
// Snapshot is a compiled form of the Bug data structure used for storage and merge
type Snapshot struct {
Title string
Comments []Comment
Labels []Label
}
+
+func (snap Snapshot) Summary() string {
+ return fmt.Sprintf("c:%d l:%d %s",
+ len(snap.Comments)-1,
+ len(snap.Labels),
+ snap.LastEdit().Format(time.RFC822),
+ )
+}
+
+func (snap Snapshot) LastEdit() time.Time {
+ lastEditTimestamp := snap.Comments[len(snap.Comments)-1].Time
+ return time.Unix(lastEditTimestamp, 0)
+}