text instead of empty list

This commit is contained in:
Erik Winter 2025-01-06 11:26:45 +01:00
parent c8ebf6df33
commit 428b828c45
3 changed files with 5 additions and 1 deletions

BIN
dist/plan vendored

Binary file not shown.

View File

@ -88,5 +88,5 @@ func (del Delete) Do(deps Dependencies) (CommandResult, error) {
type DeleteResult struct{} type DeleteResult struct{}
func (dr DeleteResult) Render() string { func (dr DeleteResult) Render() string {
return "task deleted" return "task removed"
} }

View File

@ -137,6 +137,10 @@ type ListResult struct {
} }
func (lr ListResult) Render() string { func (lr ListResult) Render() string {
if len(lr.Tasks) == 0 {
return "\nno tasks to display\n"
}
sort.Slice(lr.Tasks, func(i, j int) bool { sort.Slice(lr.Tasks, func(i, j int) bool {
if lr.Tasks[i].Task.Date.After(lr.Tasks[j].Task.Date) { if lr.Tasks[i].Task.Date.After(lr.Tasks[j].Task.Date) {
return false return false