add stringer to commit

This commit is contained in:
2023-02-17 17:54:44 -08:00
parent ec642ccefc
commit b482a11999

View File

@@ -1,6 +1,8 @@
package types package types
import ( import (
"fmt"
"strings"
"time" "time"
) )
@@ -37,3 +39,10 @@ type (
Commits []Commit `json:"commits,omitempty"` Commits []Commit `json:"commits,omitempty"`
} }
) )
func (c Commit) String() string {
return fmt.Sprintf("%s\t%s\t%s\t%s\n",
c.TimeStamp.Format("0"+time.Kitchen),
c.Author, c.Repo,
strings.TrimSpace(c.Message))
}