diff --git a/cmd/cli/command/tomorrow.go b/cmd/cli/command/tomorrow.go index c1ae768..7a1efd1 100644 --- a/cmd/cli/command/tomorrow.go +++ b/cmd/cli/command/tomorrow.go @@ -1,6 +1,8 @@ package command import ( + "sort" + "ewintr.nl/gte/cmd/cli/format" "ewintr.nl/gte/internal/configuration" "ewintr.nl/gte/internal/process" @@ -35,6 +37,8 @@ func (t *Tomorrow) Do() string { if err != nil { return format.FormatError(err) } + sort.Sort(task.ByDefault(res.Tasks)) + cols := []format.Column{format.COL_ID, format.COL_STATUS, format.COL_ACTION, format.COL_PROJECT} - return format.FormatTaskTable(res.Tasks, format.COL_ALL) + return format.FormatTaskTable(res.Tasks, cols) } diff --git a/cmd/cli/format/format.go b/cmd/cli/format/format.go index 5478ad8..1fe0f08 100644 --- a/cmd/cli/format/format.go +++ b/cmd/cli/format/format.go @@ -47,12 +47,12 @@ func FormatTaskTable(tasks []*task.LocalTask, cols []Column) string { if t.LocalStatus == task.STATUS_UPDATED { updated = append(updated, "u") } - if task.Today.After(t.Due) { + if !t.Due.IsZero() && task.Today.After(t.Due) { updated = append(updated, "o") } line = append(line, strings.Join(updated, "")) case COL_DATE: - line = append(line, t.Due.String()) + line = append(line, t.Due.Human()) case COL_ACTION: line = append(line, t.Action) case COL_PROJECT: diff --git a/internal/task/date.go b/internal/task/date.go index 9d88ccd..d4d54d0 100644 --- a/internal/task/date.go +++ b/internal/task/date.go @@ -184,6 +184,19 @@ func (d Date) String() string { return strings.ToLower(d.t.Format(DateFormat)) } +func (d Date) Human() string { + if d.t.IsZero() { + return "-" + } + + fmt.Println(Today.String(), d.String()) + if Today.Add(7).After(d) { + return strings.ToLower(d.t.Format("Monday")) + } + + return strings.ToLower(d.t.Format(DateFormat)) +} + func (d Date) IsZero() bool { return d.t.IsZero() }