tasks

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const TaskFmt = "T:%d C:%q F:%q P:%q L:%q N:%q\n"

TaskFmt is the Scanf and Printf format string used for reading and saving Tasks

Variables

This section is empty.

Functions

func Add

func Add(args []string) (ok bool)

Add creates a new Task and places it in the backlog

func All

func All(project, label string, fullTime bool) (ok bool)

All prints every tracked task

func Backlog

func Backlog(project, label string, fullTime bool) bool

Backlog prints the Backlog

func Claim

func Claim(id uint) (ok bool)

Claim moves a task from the backlog to the TODO list

func Completed

func Completed(project, label string, fullTime bool) bool

Completed prints the Completed tasks

func Done

func Done(id uint) (ok bool)

Done marks a task as completed

func Modify

func Modify(id uint, args []string) (ok bool)

Modify alters an existing task

func ParseLabel

func ParseLabel(token string) (string, bool)

ParseLabel decodes the name of a label

func ParseProject

func ParseProject(token string) (string, bool)

ParseProject decodes the name of a project

func Remove

func Remove(id uint) (ok bool)

Remove deletes a task entirely

func Report

func Report() bool

Report generates a TODO.md for the current set of tasks

func ResetCompleted

func ResetCompleted() bool

ResetCompleted permanently deletes all completed tasks

func Return

func Return(id uint) (ok bool)

Return moves a task from the TODO list back to the Backlog

func TODO

func TODO(project, label string, fullTime bool) bool

TODO prints the TODO list

func Undo

func Undo(id uint) (ok bool)

Undo moves a task from Completed to the Backlog

Types

type List

type List []Task

List is a list of one or more tasks

func (List) Len

func (l List) Len() int

Len gets the length of a List for sorting

func (List) Less

func (l List) Less(i, j int) bool

Less compares Tasks for sorting: Project -> Label -> ID

func (List) Print

func (l List) Print(project, label string, fullTime bool) bool

Print writes a List out to console

func (List) Report

func (l List) Report(w io.Writer) (err error)

Report writes the list out in Markdown format

func (List) Save

func (l List) Save(data, name string) (ok bool)

Save writes a List out to file

func (List) Swap

func (l List) Swap(i, j int)

Swap exchanges elements for sorting

type Store

type Store map[string]List

Store contains multiple lists of tasks

func (Store) Add

func (s Store) Add(t Task) (id uint, ok bool)

Add creates a new Task and places it in the backlog

func (Store) Claim

func (s Store) Claim(id uint) (ok bool)

Claim moves a task from the backlog to the TODO list

func (Store) Done

func (s Store) Done(id uint) bool

Done marks a task as completed

func (Store) Modify

func (s Store) Modify(t Task) (ok bool)

Modify updates an existing Task

func (Store) Remove

func (s Store) Remove(id uint) bool

Remove deletes a task entirely

func (Store) Report

func (s Store) Report() (ok bool)

Report generates a TODO.md for the current set of tasks

func (Store) Reset

func (s Store) Reset(name string) bool

Reset permanently deletes all tasks in a list

func (Store) Return

func (s Store) Return(id uint) bool

Return moves a task from the TODO list back to the Backlog

func (Store) Undo

func (s Store) Undo(id uint) (ok bool)

Undo moves a Task from Completed to the Backlog and resets its completion time

type Task

type Task struct {
	ID       uint
	Created  time.Time
	Finished time.Time
	Project  string
	Label    string
	Name     string
}

Task is a work item which is tracked by this program

func Read

func Read(r io.Reader) (t Task, err error)

Read parses a Task from a file

func (Task) Print

func (t Task) Print(tw io.Writer, fullTime bool) (err error)

Print writes a task to console

func (Task) Report

func (t Task) Report(w io.Writer) (err error)

Report prints out the task as Markdown

func (Task) Write

func (t Task) Write(w io.Writer) (err error)

Write encodes a Task into a file

Jump to

Keyboard shortcuts

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