feat: improve CLI output with relative dates, rich feedback, and recurring task info
Add relative date formatting (today, tomorrow, in 3d, etc.) for list and detail views. Add structured feedback helpers for add/complete/delete operations showing display IDs and parsed modifiers. Change Complete() to return spawned recurring instance so callers can display recurrence info. Add AppendTask to working set for immediate display ID assignment. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -694,25 +694,27 @@ func (t *Task) GetTags() ([]string, error) {
|
||||
return tags, nil
|
||||
}
|
||||
|
||||
// Complete marks a task as completed
|
||||
func (t *Task) Complete() error {
|
||||
// Complete marks a task as completed.
|
||||
// Returns the next recurring instance if one was spawned, or nil.
|
||||
func (t *Task) Complete() (*Task, error) {
|
||||
t.Status = StatusCompleted
|
||||
now := timeNow()
|
||||
t.End = &now
|
||||
|
||||
if err := t.Save(); err != nil {
|
||||
return err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// If this is a recurring instance, spawn next instance
|
||||
if t.ParentUUID != nil {
|
||||
if err := SpawnNextInstance(t); err != nil {
|
||||
// Log error but don't fail the completion
|
||||
return fmt.Errorf("completed task but failed to spawn next instance: %w", err)
|
||||
next, err := SpawnNextInstance(t)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("completed task but failed to spawn next instance: %w", err)
|
||||
}
|
||||
return next, nil
|
||||
}
|
||||
|
||||
return nil
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// Delete marks a task as deleted (soft delete)
|
||||
|
||||
Reference in New Issue
Block a user