Documentation
¶
Index ¶
- func Add(description string, tags []string) error
- func AddArgs(args []string) error
- func AddLine(line string) error
- func AddTags(id int, tags []string) error
- func Annotate(id int, text string) error
- func Delete(id int) error
- func Denotate(id int, text string) error
- func Done(id int) error
- func DueTasks(tasks []Task, now time.Time) int
- func Edit(id int) error
- func EditCmd(id int) *exec.Cmd
- func InProgressTasks(tasks []Task) int
- func RemoveTags(id int, tags []string) error
- func ReplaceAnnotations(id int, text string) error
- func SetDebugLog(path string) error
- func SetDescription(id int, desc string) error
- func SetDueDate(id int, due string) error
- func SetPriority(id int, priority string) error
- func SetProject(id int, project string) error
- func SetRecurrence(id int, rec string) error
- func SetStatus(id int, status string) error
- func SetStatusUUID(uuid, status string) error
- func SetTags(id int, tags []string) error
- func SortTasks(tasks []Task)
- func Start(id int) error
- func Stop(id int) error
- func TotalTasks(tasks []Task) int
- type Annotation
- type Task
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddArgs ¶
AddArgs runs "task add" with the provided arguments. Each element in args is passed as a separate command-line argument, allowing the caller to specify additional modifiers like due dates or tags.
func AddLine ¶
AddLine splits the given line into shell words and runs "task add" with the resulting arguments. This allows users to pass raw Taskwarrior parameters such as "due:today" directly.
func Denotate ¶
Denotate removes an annotation from the task with the given id. Denotate removes an annotation from the task with the given id. The annotation text is matched exactly when provided. If text is empty, the oldest annotation is removed.
func Edit ¶
Edit opens the task in an editor for manual modification. This is a convenience wrapper around EditCmd.
func EditCmd ¶
Edit opens the task in an editor for manual modification. EditCmd returns an exec.Cmd that edits the task with the given id. The caller is responsible for running the command, typically via tea.ExecProcess so that the terminal state is properly managed.
func InProgressTasks ¶
InProgressTasks returns the number of tasks that have been started and are not completed.
func RemoveTags ¶
RemoveTags removes tags from the task with the given id.
func ReplaceAnnotations ¶
ReplaceAnnotations removes all existing annotations from the task with the given id and sets a single annotation with the provided text. If text is empty, all annotations are simply removed.
func SetDebugLog ¶
SetDebugLog enables logging of executed commands to the given file. Passing an empty path disables logging.
func SetDescription ¶
SetDescription changes the description of the task with the given id.
func SetDueDate ¶
SetDueDate sets the due date for the task with the given id.
func SetPriority ¶
SetPriority changes the priority of the task with the given id.
func SetProject ¶ added in v0.9.2
SetProject changes the project of the task with the given id.
func SetRecurrence ¶
SetRecurrence sets the recurrence for the task with the given id.
func SetStatusUUID ¶
SetStatusUUID changes the status of the task with the given UUID.
func SetTags ¶
SetTags sets the tags of the task with the given id to exactly the provided set. Tags not present will be removed and new tags added as needed.
func SortTasks ¶
func SortTasks(tasks []Task)
SortTasks orders tasks by start status, priority, due date, tag names and id. Started tasks are always placed before non-started ones. Tasks without a due date are placed after tasks with a due date. Overdue tasks are placed at the very top regardless of other properties.
The sort order is: 1. Overdue tasks (oldest due date first) 2. Started tasks (not completed) 3. High priority tasks 4. Tasks with earlier due dates 5. Tasks sorted alphabetically by tags 6. Tasks sorted by ID (oldest first)
func TotalTasks ¶
TotalTasks returns the number of tasks provided.
Types ¶
type Annotation ¶
Task represents a taskwarrior task as returned by `task export`.
type Task ¶
type Task struct { ID int `json:"id"` UUID string `json:"uuid"` Description string `json:"description"` Project string `json:"project"` Tags []string `json:"tags"` Status string `json:"status"` Start string `json:"start"` Entry string `json:"entry"` Due string `json:"due"` Priority string `json:"priority"` Recur string `json:"recur"` Urgency float64 `json:"urgency"` Annotations []Annotation `json:"annotations"` }
func Export ¶
Export retrieves all tasks using `task export rc.json.array=off` and parses the JSON output into a slice of Task structs. Export retrieves tasks using `task <filter> export rc.json.array=off` and parses the JSON output into a slice of Task structs. Optional filter arguments are passed directly to the `task` command before `export`.