Documentation
¶
Index ¶
- Constants
- func Add(description string, tags []string) error
- func AddArgs(args []string) error
- func AddArgsContext(ctx context.Context, args []string) error
- func AddContext(ctx context.Context, description string, tags []string) error
- func AddLine(line string) error
- func AddLineContext(ctx context.Context, line string) error
- func AddTags(id int, tags []string) error
- func AddTagsContext(ctx context.Context, id int, tags []string) error
- func Annotate(id int, text string) error
- func AnnotateContext(ctx context.Context, id int, text string) error
- func Delete(id int) error
- func DeleteContext(ctx context.Context, id int) error
- func Denotate(id int, text string) error
- func DenotateContext(ctx context.Context, id int, text string) error
- func Done(id int) error
- func DoneContext(ctx context.Context, 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 RemoveTagsContext(ctx context.Context, id int, tags []string) error
- func ReplaceAnnotations(ctx context.Context, id int, text string) error
- func SetDebugLog(path string) error
- func SetDescription(id int, desc string) error
- func SetDescriptionContext(ctx context.Context, id int, desc string) error
- func SetDueDate(id int, due string) error
- func SetDueDateContext(ctx context.Context, id int, due string) error
- func SetPriority(id int, priority string) error
- func SetPriorityContext(ctx context.Context, id int, priority string) error
- func SetProject(id int, project string) error
- func SetProjectContext(ctx context.Context, id int, project string) error
- func SetRecurrence(id int, rec string) error
- func SetRecurrenceContext(ctx context.Context, id int, rec string) error
- func SetRecurringSeriesRecurrenceContext(ctx context.Context, rootUUID, rec string) error
- func SetStatus(id int, status string) error
- func SetStatusContext(ctx context.Context, id int, status string) error
- func SetStatusUUID(uuid, status string) error
- func SetStatusUUIDContext(ctx context.Context, uuid, status string) error
- func SetTags(ctx context.Context, id int, tags []string) error
- func SortTasks(tasks []Task)
- func Start(id int) error
- func StartContext(ctx context.Context, id int) error
- func Stop(id int) error
- func StopContext(ctx context.Context, id int) error
- func TotalTasks(tasks []Task) int
- type Annotation
- type Client
- func (Client) AddLineContext(ctx context.Context, line string) error
- func (Client) AddTagsContext(ctx context.Context, id int, tags []string) error
- func (Client) AnnotateContext(ctx context.Context, id int, text string) error
- func (Client) DoneContext(ctx context.Context, id int) error
- func (Client) DueTasks(tasks []Task, now time.Time) int
- func (Client) EditCmd(id int) *exec.Cmd
- func (Client) Export(ctx context.Context, filters ...string) ([]Task, error)
- func (Client) InProgressTasks(tasks []Task) int
- func (Client) LoadCompletionSources(ctx context.Context) CompletionSources
- func (Client) RecurringSeries(ctx context.Context, rootUUID string) ([]Task, error)
- func (Client) RemoveTagsContext(ctx context.Context, id int, tags []string) error
- func (Client) ReplaceAnnotations(ctx context.Context, id int, text string) error
- func (Client) RunShellLine(ctx context.Context, line string) (RunResult, error)
- func (Client) SetDescriptionContext(ctx context.Context, id int, desc string) error
- func (Client) SetDueDateContext(ctx context.Context, id int, due string) error
- func (Client) SetPriorityContext(ctx context.Context, id int, priority string) error
- func (Client) SetProjectContext(ctx context.Context, id int, project string) error
- func (Client) SetRecurrenceContext(ctx context.Context, id int, rec string) error
- func (Client) SetRecurringSeriesRecurrenceContext(ctx context.Context, rootUUID, rec string) error
- func (Client) SetStatusUUIDContext(ctx context.Context, uuid, status string) error
- func (Client) SortTasks(tasks []Task)
- func (Client) StartContext(ctx context.Context, id int) error
- func (Client) StopContext(ctx context.Context, id int) error
- func (Client) TotalTasks(tasks []Task) int
- type CompletionSources
- type RunResult
- type Task
- type Taskwarrior
Constants ¶
const DateFormat = "20060102T150405Z"
DateFormat is the date format used by Taskwarrior in all date fields (e.g. Entry, Due, Start). All date parsing and formatting in this package uses this constant.
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 AddArgsContext ¶ added in v0.18.1
AddArgsContext runs "task add" with the provided arguments using ctx for the underlying Taskwarrior command.
func AddContext ¶ added in v0.18.1
AddContext creates a new task with the given description and tags using ctx for the underlying Taskwarrior command.
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 AddLineContext ¶ added in v0.18.1
AddLineContext splits the given line into shell words and runs "task add" with the resulting arguments using ctx for the underlying Taskwarrior command.
func AddTagsContext ¶ added in v0.18.1
AddTagsContext adds tags to the task with the given id using ctx for the underlying Taskwarrior command.
func AnnotateContext ¶ added in v0.18.1
AnnotateContext adds an annotation to the task with the given id using ctx for the underlying Taskwarrior command.
func DeleteContext ¶ added in v0.18.1
DeleteContext removes the task with the given id using ctx for the underlying Taskwarrior command.
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 DenotateContext ¶ added in v0.18.1
DenotateContext removes an annotation from the task with the given id using ctx for the underlying Taskwarrior command.
func DoneContext ¶ added in v0.18.1
DoneContext marks the task with the given id as completed using ctx for the underlying Taskwarrior command.
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 RemoveTagsContext ¶ added in v0.18.1
RemoveTagsContext removes tags from the task with the given id using ctx for the underlying Taskwarrior command.
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 and closes any previously opened file.
func SetDescription ¶
SetDescription changes the description of the task with the given id.
func SetDescriptionContext ¶ added in v0.18.1
SetDescriptionContext changes the description of the task with the given id using ctx for the underlying Taskwarrior command.
func SetDueDate ¶
SetDueDate sets the due date for the task with the given id.
func SetDueDateContext ¶ added in v0.18.1
SetDueDateContext sets the due date for the task with the given id using ctx for the underlying Taskwarrior command.
func SetPriority ¶
SetPriority changes the priority of the task with the given id.
func SetPriorityContext ¶ added in v0.18.1
SetPriorityContext changes the priority of the task with the given id using ctx for the underlying Taskwarrior command.
func SetProject ¶ added in v0.9.2
SetProject changes the project of the task with the given id.
func SetProjectContext ¶ added in v0.18.1
SetProjectContext changes the project of the task with the given id using ctx for the underlying Taskwarrior command.
func SetRecurrence ¶
SetRecurrence sets the recurrence for the task with the given id.
func SetRecurrenceContext ¶ added in v0.18.1
SetRecurrenceContext sets the recurrence for the task with the given id using ctx for the underlying Taskwarrior command.
func SetRecurringSeriesRecurrenceContext ¶ added in v0.18.1
SetRecurringSeriesRecurrenceContext sets the recurrence for every known task in a recurring series identified by rootUUID.
func SetStatusContext ¶ added in v0.18.1
SetStatusContext changes the status of the task with the given id using ctx for the underlying Taskwarrior command.
func SetStatusUUID ¶
SetStatusUUID changes the status of the task with the given UUID.
func SetStatusUUIDContext ¶ added in v0.18.1
SetStatusUUIDContext changes the status of the task with the given UUID using ctx for the underlying Taskwarrior command.
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 StartContext ¶ added in v0.18.1
StartContext begins the task with the given id using ctx for the underlying Taskwarrior command.
func StopContext ¶ added in v0.18.1
StopContext stops the task with the given id using ctx for the underlying Taskwarrior command.
func TotalTasks ¶
TotalTasks returns the number of tasks provided.
Types ¶
type Annotation ¶
Task represents a taskwarrior task as returned by `task export`.
type Client ¶ added in v0.18.1
type Client struct{}
Client is the production Taskwarrior implementation backed by the task CLI.
func NewTaskwarrior ¶ added in v0.18.1
func NewTaskwarrior() Client
NewTaskwarrior returns a production Taskwarrior Client.
func (Client) AddLineContext ¶ added in v0.18.1
AddLineContext adds a task from a shell-style input line.
func (Client) AddTagsContext ¶ added in v0.18.1
AddTagsContext adds tags to a task.
func (Client) AnnotateContext ¶ added in v0.18.1
AnnotateContext adds an annotation to a task.
func (Client) DoneContext ¶ added in v0.18.1
DoneContext completes a task.
func (Client) InProgressTasks ¶ added in v0.18.1
InProgressTasks returns the number of started, incomplete tasks.
func (Client) LoadCompletionSources ¶ added in v0.18.1
func (Client) LoadCompletionSources(ctx context.Context) CompletionSources
LoadCompletionSources returns Taskwarrior-provided completion candidates.
func (Client) RecurringSeries ¶ added in v0.18.1
RecurringSeries returns a recurring task series.
func (Client) RemoveTagsContext ¶ added in v0.18.1
RemoveTagsContext removes tags from a task.
func (Client) ReplaceAnnotations ¶ added in v0.18.1
ReplaceAnnotations replaces all annotations on a task.
func (Client) RunShellLine ¶ added in v0.18.1
RunShellLine runs a user-entered Taskwarrior shell command.
func (Client) SetDescriptionContext ¶ added in v0.18.1
SetDescriptionContext changes a task description.
func (Client) SetDueDateContext ¶ added in v0.18.1
SetDueDateContext changes a task due date.
func (Client) SetPriorityContext ¶ added in v0.18.1
SetPriorityContext changes a task priority.
func (Client) SetProjectContext ¶ added in v0.18.1
SetProjectContext changes a task project.
func (Client) SetRecurrenceContext ¶ added in v0.18.1
SetRecurrenceContext changes a task recurrence value.
func (Client) SetRecurringSeriesRecurrenceContext ¶ added in v0.18.1
SetRecurringSeriesRecurrenceContext changes a recurring series recurrence value.
func (Client) SetStatusUUIDContext ¶ added in v0.18.1
SetStatusUUIDContext changes a task status by UUID.
func (Client) SortTasks ¶ added in v0.18.1
SortTasks orders tasks using TaskSamurai's default task ordering.
func (Client) StartContext ¶ added in v0.18.1
StartContext starts a task.
func (Client) StopContext ¶ added in v0.18.1
StopContext stops a task.
func (Client) TotalTasks ¶ added in v0.18.1
TotalTasks returns the number of tasks provided.
type CompletionSources ¶ added in v0.18.0
type CompletionSources struct {
Commands []string
Columns []string
Projects []string
Tags []string
IDs []string
UUIDs []string
UDAs []string
}
CompletionSources contains values used for Taskwarrior shell completion.
func LoadCompletionSources ¶ added in v0.18.0
func LoadCompletionSources(ctx context.Context) CompletionSources
LoadCompletionSources returns Taskwarrior-provided completion candidates.
type RunResult ¶ added in v0.18.0
RunResult contains the captured output from a task command invocation.
func RunLine ¶ added in v0.18.0
RunLine splits line using shell-word rules and runs the resulting task arguments. A leading "task" token is ignored so callers may accept either "add foo" or "task add foo" from user input.
func RunShellLine ¶ added in v0.18.0
RunShellLine runs a user-entered task command in non-interactive mode. It avoids Taskwarrior's recurring-task prompt by applying the same behavior as answering "no": modify only the addressed recurrence.
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"`
Parent string `json:"parent"`
RType string `json:"rtype"`
Urgency float64 `json:"urgency"`
Annotations []Annotation `json:"annotations"`
}
type Taskwarrior ¶ added in v0.18.1
type Taskwarrior interface {
Export(ctx context.Context, filters ...string) ([]Task, error)
SortTasks(tasks []Task)
TotalTasks(tasks []Task) int
InProgressTasks(tasks []Task) int
DueTasks(tasks []Task, now time.Time) int
EditCmd(id int) *exec.Cmd
RunShellLine(ctx context.Context, line string) (RunResult, error)
LoadCompletionSources(ctx context.Context) CompletionSources
AddLineContext(ctx context.Context, line string) error
AnnotateContext(ctx context.Context, id int, text string) error
ReplaceAnnotations(ctx context.Context, id int, text string) error
SetDescriptionContext(ctx context.Context, id int, desc string) error
AddTagsContext(ctx context.Context, id int, tags []string) error
RemoveTagsContext(ctx context.Context, id int, tags []string) error
SetDueDateContext(ctx context.Context, id int, due string) error
SetRecurrenceContext(ctx context.Context, id int, rec string) error
SetRecurringSeriesRecurrenceContext(ctx context.Context, rootUUID, rec string) error
SetProjectContext(ctx context.Context, id int, project string) error
SetPriorityContext(ctx context.Context, id int, priority string) error
StartContext(ctx context.Context, id int) error
StopContext(ctx context.Context, id int) error
DoneContext(ctx context.Context, id int) error
SetStatusUUIDContext(ctx context.Context, uuid, status string) error
RecurringSeries(ctx context.Context, rootUUID string) ([]Task, error)
}
Taskwarrior describes the Taskwarrior operations required by the UI.