all repos — todo.txt-go @ 49cddf73ecfcad25087068f81c435c61b55f00fb

CLI tool for todo.txt files written in Go

💄 Improve recurring task style
Tim Izzo tim@5ika.ch
Wed, 10 Sep 2025 16:43:13 +0200
commit

49cddf73ecfcad25087068f81c435c61b55f00fb

parent

c5899e9d434d528f19a7e775a4affb98efbae057

3 files changed, 15 insertions(+), 2 deletions(-)

jump to
M README.mdREADME.md

@@ -76,7 +76,7 @@ (C) Update servers freq:month due:2025-09-05

``` On check of this task, it will be duplicated with a new due date (`2025-10-05`). -If it doesn't have a due date, the next due date is calculated from today's date. +If it doesn't have a due date or if due date is in the past, the next due date is calculated from today's date. Available frequency values are: - `day`, `daily`
M scheduling.goscheduling.go

@@ -45,6 +45,11 @@ return &todo.Task{}

} func getNextDueDate(dueDate time.Time, frequency Frequency) time.Time { + + if dueDate.Before(time.Now()) { + dueDate = time.Now() + } + switch frequency { case Day: return dueDate.AddDate(0, 0, 1)
M style.gostyle.go

@@ -28,6 +28,7 @@

type TaskStyle struct { Todo lipgloss.Style Completed lipgloss.Style + Futur lipgloss.Style } type PriorityStyle struct {

@@ -48,6 +49,7 @@

taskStyle := TaskStyle{ Todo: lipgloss.NewStyle().Foreground(lipgloss.Color(Catppuccin.Text().Hex)), Completed: lipgloss.NewStyle().Strikethrough(true).Foreground(lipgloss.Color(Catppuccin.Overlay2().Hex)), + Futur: lipgloss.NewStyle().Foreground(lipgloss.Color(Catppuccin.Overlay1().Hex)), } priorityStyle := PriorityStyle{

@@ -122,7 +124,13 @@ default:

dueDateString = s.Date.futur.Render(formatedDueDate) } } - return fmt.Sprintf("%s %s %s %s", s.Check.Render(checkString), s.getPriorityStyle(task.Priority), s.Task.Todo.Render(todoText), dueDateString) + + todoTextRender := s.Task.Todo + if task.AdditionalTags["freq"] != "" && !task.IsOverdue() && !task.IsDueToday() { + todoTextRender = s.Task.Futur + } + + return fmt.Sprintf("%s %s %s %s", s.Check.Render(checkString), s.getPriorityStyle(task.Priority), todoTextRender.Render(todoText), dueDateString) } }