This commit is contained in:
2022-06-19 15:41:13 -06:00
parent 05760bbb38
commit 7281592493

View File

@@ -1,19 +1,16 @@
package main package gico
import ( import (
"flag" "flag"
"fmt" "fmt"
"os" "os"
"time" "time"
"github.com/taigrr/gico/ui"
) )
type Month string type Month string
var months = []Month{"Jan", "Feb", "Mar",
"Apr", "May", "Jun",
"Jul", "Aug", "Sep",
"Oct", "Nov", "Dec"}
var days [366]int var days [366]int
func init() { func init() {
@@ -34,7 +31,7 @@ func main() {
case "graph": case "graph":
printGraph() printGraph()
case "interactive": case "interactive":
interactiveGraph() ui.InteractiveGraph()
case "loadRepo": case "loadRepo":
loadRepo() loadRepo()
default: default:
@@ -43,10 +40,12 @@ func main() {
} }
type Commit struct { type Commit struct {
LOC int `json:"loc"` LOC int `json:"loc,omitempty"`
Message string `json:"message"` Message string `json:"message,omitempty"`
TimeStamp time.Time `json:"ts"` TimeStamp time.Time `json:"ts,omitempty"`
Author string `json:"author"` Author string `json:"author,omitempty"`
Repo string `json:"repo,omitempty"`
Path string `json:"path,omitempty"`
} }
type DataSet map[time.Time]WorkDay type DataSet map[time.Time]WorkDay
@@ -54,17 +53,22 @@ type DataSet map[time.Time]WorkDay
type WorkDay struct { type WorkDay struct {
Day time.Time `json:"day"` Day time.Time `json:"day"`
Count int `json:"count"` Count int `json:"count"`
Message string `json:"message,omitempty"`
Commits []Commit `json:"commits,omitempty"` Commits []Commit `json:"commits,omitempty"`
} }
func NewCommit(Author, Message, Repo, Path string, LOC int) Commit {
ci := Commit{Message: Message,
Author: Author, LOC: LOC, TimeStamp: time.Now(),
Repo: Repo, Path: Path}
return ci
}
func loadRepo() { func loadRepo() {
} }
func readCommitDB() DataSet { func readCommitDB() DataSet {
ds := DataSet{} ds := DataSet{}
ds = append(ds,
return ds return ds
} }
func printHelp() { func printHelp() {
@@ -73,7 +77,7 @@ func printHelp() {
func increment() { func increment() {
commits := readCommitDB() commits := readCommitDB()
// crea
fmt.Printf("%v\n", commits) fmt.Printf("%v\n", commits)
} }