summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorPaul Bütow <1224732+snonux@users.noreply.github.com>2025-06-20 00:09:10 +0300
committerPaul Bütow <1224732+snonux@users.noreply.github.com>2025-06-20 00:09:10 +0300
commit0dd71db839d29b638e3072259bc9ab44c6864a2d (patch)
tree8c1c605913013d16fafe865729e7ac236eb5b594 /cmd
parent15dcd6f5baad135b1472b79886bce9a77189dcf3 (diff)
Add help screen and improve due date display
Diffstat (limited to 'cmd')
-rw-r--r--cmd/tasksamurai/main.go19
1 files changed, 14 insertions, 5 deletions
diff --git a/cmd/tasksamurai/main.go b/cmd/tasksamurai/main.go
index 424d0d8..658cb05 100644
--- a/cmd/tasksamurai/main.go
+++ b/cmd/tasksamurai/main.go
@@ -7,6 +7,8 @@ import (
"strings"
"time"
+ "github.com/charmbracelet/lipgloss"
+
"tasksamurai/internal/task"
"tasksamurai/internal/ui"
@@ -66,18 +68,25 @@ func taskToRow(t task.Task) table.Row {
t.Priority,
tags,
t.Recur,
- formatDate(t.Due),
+ formatDue(t.Due),
urg,
strings.Join(anns, "; "),
}
}
-func formatDate(s string) string {
+func formatDue(s string) string {
if s == "" {
return ""
}
- if ts, err := time.Parse("20060102T150405Z", s); err == nil {
- return ts.Format("2006-01-02")
+ ts, err := time.Parse("20060102T150405Z", s)
+ if err != nil {
+ return s
+ }
+
+ days := int(time.Until(ts).Hours() / 24)
+ val := fmt.Sprintf("%dd", days)
+ if days < 0 {
+ val = lipgloss.NewStyle().Background(lipgloss.Color("1")).Render(val)
}
- return s
+ return val
}