Help us shape the future of Go! Take the 2026 Go Developer Survey

tasks

package
v0.13.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package tasks serves the Taskwarrior operations of the web API behind `workflow --web`: the task list, the event stream's summary of your tasks, and the writes on them, over the seam the terminal's Tasks pane asks. It changes with the tool it drives, so it sits apart from the rest of the server, which embeds its Handlers and hands it what it takes from the server through a Kit.

Index

Constants

This section is empty.

Variables

View Source
var ErrStartDeclined = errors.New("taskwarrior declined to start the task")

ErrStartDeclined is a start Taskwarrior declined, which has words of its own: a finished task is reopened, not declined.

Functions

This section is empty.

Types

type Handlers

type Handlers struct {
	// contains filtered or unexported fields
}

Handlers implements the Taskwarrior operations of api.StrictServerInterface, and the event stream's summary of your tasks.

func New

func New(seams Seams, bound config.Taskwarrior, kit Kit) *Handlers

New builds the handlers over seams, bound with the taskwarrior settings in bound, taking the rest from the server through kit.

func (*Handlers) AddTask

AddTask adds a task from a line in Taskwarrior's grammar, refusing an empty line before Taskwarrior is asked.

func (*Handlers) AnnotateTask

AnnotateTask adds a note to the task the path names, refusing one with no text before Taskwarrior is asked.

func (*Handlers) CompleteTask

CompleteTask marks the task the path names done, and answers the list after it with the task beside it as the linked tasks describe it now, since the list no longer holds it.

func (*Handlers) ListTasks

ListTasks answers your pending tasks, or why no Taskwarrior can be asked — an answer about where the server runs, as the review queue's is, not a missing resource.

func (*Handlers) ModifyTask

ModifyTask changes the task the path names by a line in Taskwarrior's grammar, refusing an empty line before Taskwarrior is asked.

func (*Handlers) StartTask

StartTask starts the task the path names.

func (*Handlers) StopTask

StopTask stops the task the path names.

func (*Handlers) Summary

func (h *Handlers) Summary(ctx context.Context) api.TasksSummary

Summary is the stream's summary of your tasks: whether Taskwarrior can be asked, and why not; the started task; and every task linked to an issue. Until Taskwarrior has answered both reads the summary is unavailable, as the terminal draws no task mark until it has, so a page never takes a read that failed for "no task tracks this issue" and offers to track it again.

func (*Handlers) SyncTasks

SyncTasks syncs Taskwarrior with the backend its taskrc names, and says what it printed.

func (*Handlers) TrackIssue

TrackIssue adds a task for an issue as the tracker has it — its key and page, the jira tag, its priority in Taskwarrior's words, and "KEY: summary" — then annotates the task with the issue's page, when there is one. The issue is read before Taskwarrior is asked anything, so an issue the tracker does not have adds no task, and neither does a key the tracker gives that is not one word: the rest would reach Taskwarrior as words of their own, ahead of the line's --.

func (*Handlers) UndoTasks

UndoTasks reverts Taskwarrior's last change, and says how much it reverted.

type Kit

type Kit struct {
	// Fault maps a seam's error onto the server's problem, classified, for a
	// failure no Taskwarrior words explain.
	Fault func(err error) api.Problem
	// Config is the taskwarrior settings in effect, which a save in Settings
	// may have changed since the server started.
	Config func() config.Taskwarrior
	// Now is the time by the server's clock.
	Now func() time.Time
	// BrowseURL is the issue's page in the tracker. Nil means no tracker link
	// is wired, so a task links only its own jiraurl and a track annotates
	// nothing.
	BrowseURL func(key jira.Key) string
	// Outliving is a context with ctx's values that goes on when ctx ends and
	// ends when the server stops, and the function that releases it, for the
	// search for Taskwarrior every stream shares.
	Outliving func(ctx context.Context) (context.Context, context.CancelFunc)
	// Home is your home directory, which Taskwarrior's words can name and a
	// refusal shows as ~; empty leaves them naming it.
	Home string
}

Kit is what the handlers take from the server that embeds them. Fault, Config, Now and Outliving are required; BrowseURL and Home say what their absence means.

type Seams

type Seams struct {
	// Tasks is what the handlers ask of Taskwarrior. A nil Install, or one
	// that fails, answers the task list and the snapshot's summary as not
	// available — never a 404 — and a write with a nil function is refused as
	// unprocessable.
	Tasks seams.Tasks
	// Issue reads the issue a track adds a task for. Nil means no issue
	// tracker is configured, and a track is refused as unprocessable.
	Issue func(ctx context.Context, issueKey jira.Key) (jira.IssueDetail, error)
}

Seams is what the handlers ask of the world.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL