output cli tomorrow
This commit is contained in:
parent
3c08825613
commit
e5f76c840e
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue