Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var TASKRC = PathExpandTilda("~/.taskrc")
Default configuration path.
Functions ¶
func GetAvailableKeys ¶
func GetAvailableKeys() []string
Return list of available configuration options represented by TaskRC structure fields.
func PathExpandTilda ¶
Expand tilda in filepath as $HOME of current user.
func ValidateTask ¶
ValidateTask checks if the task has all required fields. Returns error if validation fails.
func ValidateTaskRC ¶
ValidateTaskRC checks if the TaskRC has valid configuration. Returns error if validation fails.
Types ¶
type Annotation ¶
Annotation represents a task annotation.
type Filter ¶
type Filter struct {
Project string // Filter by project (e.g., "MyProject")
Tags []string // Filter by tags (e.g., ["urgent", "work"])
Status string // Filter by status (e.g., "pending", "completed")
UUIDs []string // Filter by specific UUIDs (e.g., ["uuid1", "uuid2"])
}
Filter represents query parameters for filtering tasks. Used with QueryTasks() to filter exported task data.
type Task ¶
type Task struct {
Id int32 `json:"id"`
Description string `json:"description"`
Project string `json:"project,omitempty"`
Status string `json:"status,omitempty"`
Uuid string `json:"uuid,omitempty"`
Urgency float32 `json:"urgency,omitempty"`
Priority string `json:"priority,omitempty"`
Due string `json:"due,omitempty"`
Start string `json:"start,omitempty"`
End string `json:"end,omitempty"`
Entry string `json:"entry,omitempty"`
Until string `json:"until,omitempty"`
Wait string `json:"wait,omitempty"`
Scheduled string `json:"scheduled,omitempty"`
Recur string `json:"recur,omitempty"`
Mask string `json:"mask,omitempty"`
Imask int `json:"imask,omitempty"`
Parent string `json:"parent,omitempty"`
Modified string `json:"modified,omitempty"`
Depends []string `json:"depends,omitempty"`
Tags []string `json:"tags,omitempty"`
Annotations []Annotation `json:"annotations,omitempty"`
UDA map[string]interface{} `json:"-"`
}
Task representation.
type TaskRC ¶
type TaskRC struct {
ConfigPath string // Location of this .taskrc
DataLocation string `taskwarrior:"data.location"`
DependencyTracking string `taskwarrior:"dependency.on"`
Recall string `taskwarrior:"recurrence"`
RecallAfter string `taskwarrior:"recurrence.limit"`
}
Describes configuration file entries that currently supported by this library.
func ParseTaskRC ¶
Return new TaskRC struct instance that contains fields with given configuration file values.
type TaskWarrior ¶
type TaskWarrior struct {
Config *TaskRC // Configuration options
Tasks []Task // Task JSON entries
}
Represents a single taskwarrior instance.
func NewTaskWarrior ¶
func NewTaskWarrior(configPath string) (*TaskWarrior, error)
Create new empty TaskWarrior instance.
func (*TaskWarrior) AddTask ¶
func (tw *TaskWarrior) AddTask(task *Task)
Add new Task entry to given TaskWarrior.
func (*TaskWarrior) Commit ¶
func (tw *TaskWarrior) Commit() error
Save current changes of given TaskWarrior instance.
func (*TaskWarrior) FetchAllTasks ¶
func (tw *TaskWarrior) FetchAllTasks() error
Fetch all tasks for given TaskWarrior with system `taskwarrior` command call.
func (*TaskWarrior) PrintTasks ¶
func (tw *TaskWarrior) PrintTasks()
Pretty print for all tasks represented in given TaskWarrior.
func (*TaskWarrior) QueryTasks ¶
func (tw *TaskWarrior) QueryTasks(filter Filter) ([]Task, error)
QueryTasks retrieves tasks matching the specified filters using Taskwarrior's native filtering capabilities. This is more efficient than fetching all tasks and filtering in memory.
Example:
filter := taskwarrior.Filter{Project: "work", Tags: ["urgent"]}
tasks := tw.QueryTasks(filter)
For more filter syntax, see: https://taskwarrior.org/docs/userguide/#filtering-tasks