todo

package module
v0.0.0-...-6f0648f Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2015 License: BSD-3-Clause Imports: 6 Imported by: 1

README

Todo

Todo is a todo list manager that works with a simple text format.

Ideally, this is usable without the command. The command just helps.

The Format

Why not todo.txt?

It has more than I need or will use.

Examples:
Take out trash
2014-12-23 Feed cats
Write novel 2015-12-31 s:2015-12-30
x Eat lunch
The Specification

A todo is a single line of utf8 text. All whitespace characters are treated as spaces. Each whitespace separated string is treated as a token. The rules for parsing are as follows:

  • If the first token of the file is an x lower case x, the task is completed.
  • If the token matches the date format YYYY-MM-DD, it is the due date of the task.
  • If the token matches the date format s:YYYY-MM-DD, it is the schedules start date of the task.
  • If the token starts with + and len(token) > 1, the token specifies a case-insensitive tag.
  • If the token starts with @ and len(token) > 1, the token specifies a case-insensitive context.
  • Otherwise, the token is part of the title of the task.

The Command

Install

To install from source, you'll need Go installed. With a properly configured GOPATH, run go get github.com/millere/todo/.... The compiled todo binary will be placed in $GOPATH/bin.

Usage

Todo has four commands: add, list, x, and archive.

add
todo add update readme 2015-01-08 @computer

Add parses the given line as a todo to check syntax and adds it to the todo file.

list
todo list
todo list @computer
todo list readme
todo list -s

List lists todos. If words are given, it filters by matching all of those words. The -s flag sorts the results in a way I find useful. This -a flag causes completed tasks to be listed.

help
todo help
todo help list

Prints usage information.

x
todo x 3

X marks task n as completed.

archive
todo archive

Archive moves all completed tasks from the todo file to the archive file.

The Library

GoDoc

As much functionality of the command as possible has been implemented in the library.

Documentation

Overview

package todo implements a parser for my minimal todo list format.

Index

Constants

View Source
const DateFormat = "2006-1-2"

DateFormat is YY-MM-DD, with no times, time zone, etc.

Variables

This section is empty.

Functions

This section is empty.

Types

type Task

type Task struct {
	Title    string
	Start    time.Time
	Due      time.Time
	Tags     []string
	Contexts []string

	Raw  string
	Done bool
	// contains filtered or unexported fields
}

A Task is represents a item in a todo list

func Parse

func Parse(r string) (Task, error)

Parse takes a string and parses it as todo.txt formatted todo item

func (Task) Matches

func (t Task) Matches(query string) bool

func (Task) String

func (t Task) String() string

func (Task) UnParse

func (t Task) UnParse() string

UnParse converts a task into a parseable string This may not be the same string as the original, but they will parse to the same task.

type TaskList

type TaskList []Task

A TaskList is a list of tasks

func FromReader

func FromReader(r io.Reader) (TaskList, error)

func (TaskList) Filter

func (ts TaskList) Filter(query string) TaskList

Filter returns a new tasklist containing all of the tasks that match the query

func (TaskList) FilterNot

func (ts TaskList) FilterNot(query string) TaskList

FilterNot returns a new tasklist containing all of the tasks that do not match the query

func (TaskList) Len

func (l TaskList) Len() int

func (TaskList) Less

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

func (TaskList) Swap

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

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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