chore: splitting monolith into packages

This commit is contained in:
2026-04-02 17:22:55 +02:00
parent 3d61c78c35
commit be1dd05d9b
9 changed files with 171 additions and 116 deletions

31
utils/table_render.go Normal file
View File

@@ -0,0 +1,31 @@
package utils
import (
"gotask-cli/models"
"os"
"time"
"github.com/jedib0t/go-pretty/v6/table"
)
func PrintTasksAsATable(tasks []models.Task) {
t := table.NewWriter()
t.SetOutputMirror(os.Stdout)
t.AppendHeader(table.Row{"Id", "Description", "Status", "Created", "Updated"})
for _, v := range tasks {
var updated string
if v.Updated == -1 {
updated = ""
} else {
updated = time.Unix(v.Updated, 0).Format(time.DateTime)
}
t.AppendRow([]interface{}{
v.Id,
v.Description,
models.StatusName[v.Status],
time.Unix(v.Created, 0).Format(time.DateTime),
updated,
})
}
t.Render()
}