Documentation ¶
Overview ¶
The purpose of this package is to provide an API that strictly complies with the todotxt spec. In particular this means that any non-standard behavior (including recurring tasks) does not belong here, but in the extensions package
Index ¶
- Variables
- func MatcherForTag(key string) *regexp.Regexp
- type BuildFunc
- func CopyOf(item *Item) BuildFunc
- func WithCompletionDate(date time.Time) BuildFunc
- func WithCreationDate(date time.Time) BuildFunc
- func WithDescription(desc string) BuildFunc
- func WithDone(done bool) BuildFunc
- func WithMeta(done bool, prio Priority, completionDate time.Time, creationDate time.Time) BuildFunc
- func WithNowFunc(now func() time.Time) BuildFunc
- func WithPriority(prio Priority) BuildFunc
- func WithoutCompletionDate() BuildFunc
- func WithoutCreationDate() BuildFunc
- type Context
- type Decoder
- type Encoder
- type Event
- type Hook
- type HookFunc
- type Item
- func (i *Item) Apply(item *Item) error
- func (i *Item) CleanDescription(projects []Project, contexts []Context, tags []string) string
- func (i *Item) Complete() error
- func (i *Item) CompletionDate() *time.Time
- func (i *Item) Contexts() []Context
- func (i *Item) CreationDate() *time.Time
- func (i *Item) Description() string
- func (i *Item) Done() bool
- func (i *Item) EditDescription(desc string) error
- func (i *Item) Equals(item *Item) bool
- func (i *Item) MarkUndone() error
- func (i *Item) PrioritizeAs(prio Priority) error
- func (i *Item) Priority() Priority
- func (i *Item) Projects() []Project
- func (i *Item) SetCreation(creation time.Time) error
- func (i *Item) SetTag(key, value string) error
- func (i *Item) String() string
- func (i *Item) Tags() Tags
- type JsonEncoder
- type List
- func (l *List) Add(items ...*Item) (err error)
- func (l *List) AddHook(hook Hook)
- func (l *List) AllContexts() []Context
- func (l *List) AllProjects() []Project
- func (l *List) AllTags() []string
- func (l *List) GetLine(line int) *Item
- func (l *List) Len() int
- func (l *List) LineOf(i *Item) int
- func (l *List) Remove(line int) error
- func (l *List) Reset()
- func (l *List) Secret(secretChange func() error) error
- func (l *List) Snapshot()
- func (l *List) Tasks() []*Item
- type ModEvent
- type NotesRepo
- type OLockError
- type ParseError
- type Priority
- type Project
- type ReadError
- type ReadFunc
- type Repo
- type Tags
- type ValidationError
- type ValidationEvent
Constants ¶
This section is empty.
Variables ¶
var DefaultDecoder = Decoder{}
var DefaultEncoder = Encoder{}
var DefaultJsonEncoder = JsonEncoder{}
var ErrAbort = errors.New("operation aborted by hook")
var ErrCompleteBeforeCreation = errors.New("completion date can not be before creation date")
var ErrCompletionDateWhileUndone = errors.New("completion date can not be set on undone task")
var ErrCreationDateUnset = errors.New("completion date can not be set while creation date is not")
var ErrNoPrioWhenDone = errors.New("done tasks must not have a priority")
var NoNoteIdsError = errors.New("could not find a new id in a reasonable amount of time. Try running \"quest notes clean\" or consider increasting id length")
Functions ¶
func MatcherForTag ¶
MatcherForTag returns a regular expression that matches a tag with the supplied key. To access the value consult submatch 1
Any leading/trailing whitespace in key will be removed before constructing the matcher Any remaining whitespace will be replaced with +
Types ¶
type BuildFunc ¶
func WithCompletionDate ¶
func WithCreationDate ¶
func WithDescription ¶
func WithNowFunc ¶
func WithPriority ¶
func WithoutCompletionDate ¶
func WithoutCompletionDate() BuildFunc
func WithoutCreationDate ¶
func WithoutCreationDate() BuildFunc
type Context ¶
type Context string
type HookFunc ¶
func (HookFunc) OnValidate ¶
func (h HookFunc) OnValidate(*List, ValidationEvent) error
type Item ¶
type Item struct {
// contains filtered or unexported fields
}
func MustBuildItem ¶
func (*Item) CleanDescription ¶
func (*Item) CompletionDate ¶
func (*Item) CreationDate ¶
func (*Item) Description ¶
func (*Item) EditDescription ¶
func (*Item) MarkUndone ¶
func (*Item) PrioritizeAs ¶
type JsonEncoder ¶
type JsonEncoder struct { }
type List ¶
type List struct {
// contains filtered or unexported fields
}
func (*List) AllContexts ¶
func (*List) AllProjects ¶
type ModEvent ¶
ModEvent is an event that is issued whenever a modification to the list happens. In case a task was added previous will be nil and current non-nil In case an existing task was modified both will be non-nil In case a task was removed previous will be non-nil and current will be nil It is legal to modify Current from within a hook. e.g. to undo a change do `*Current = *Previous`
func (ModEvent) IsCompleteEvent ¶
type NotesRepo ¶ added in v0.4.0
type NotesRepo struct { IdLength int // contains filtered or unexported fields }
func NewNotesRepo ¶ added in v0.4.0
type OLockError ¶
type OLockError struct {
BackupPath string
}
func (OLockError) Error ¶
func (o OLockError) Error() string
type ParseError ¶
type ParseError struct {
// contains filtered or unexported fields
}
func (ParseError) Error ¶
func (p ParseError) Error() string
type Priority ¶
type Priority byte
const ( PrioNone Priority = iota PrioZ PrioY PrioX PrioW PrioV PrioU PrioT PrioS PrioR PrioQ PrioP PrioO PrioN PrioM PrioL PrioK PrioJ PrioI PrioH PrioG PrioF PrioE PrioD PrioC PrioB PrioA )
Reverse order so that wen can compare using <=
func PriorityFromString ¶
type Project ¶
type Project string
type Repo ¶
type Repo struct { Encoder *Encoder Decoder *Decoder DefaultHooks []Hook Keep int // contains filtered or unexported fields }
type ValidationError ¶
func (ValidationError) Error ¶
func (v ValidationError) Error() string
func (ValidationError) Unwrap ¶
func (v ValidationError) Unwrap() error
type ValidationEvent ¶
type ValidationEvent struct {
Item *Item
}