Documentation ¶
Index ¶
- Constants
- func AddIfNotThere(arr []string, items []string) []string
- func EditTodo(todo *Todo, todoList *TodoList, filter *Filter) error
- func UserHomeDir() string
- type App
- func (a *App) AddNote(todoID int, note string)
- func (a *App) AddTodo(input string)
- func (a *App) ArchiveCompleted()
- func (a *App) ArchiveTodo(input string)
- func (a *App) CompleteTodo(input string, archive bool)
- func (a *App) DeleteNote(todoID int, noteID int)
- func (a *App) DeleteTodo(input string)
- func (a *App) EditNote(todoID int, noteID int, note string)
- func (a *App) EditTodo(todoID int, input string)
- func (a *App) GarbageCollect()
- func (a *App) InitializeRepo()
- func (a *App) ListTodos(input string, showNotes bool, showStatus bool)
- func (a *App) PrioritizeTodo(input string)
- func (a *App) SetTodoStatus(input string)
- func (a *App) UnarchiveTodo(input string)
- func (a *App) UncompleteTodo(input string)
- func (a *App) UnprioritizeTodo(input string)
- type ByDate
- type DateParser
- type EventLog
- type EventLogger
- type FileStore
- type Filter
- type GroupedTodos
- type Grouper
- type InputParser
- type MemoryPrinter
- type MemoryStore
- type Printer
- type Recurrence
- type ScreenPrinter
- type SimpleScreenPrinter
- type Store
- type SyncedList
- type Todo
- func (t *Todo) Archive()
- func (t Todo) CalculateDueTime() time.Time
- func (t *Todo) Complete()
- func (t Todo) CompletedDateToDate() string
- func (t Todo) Equals(other *Todo) bool
- func (t Todo) HasNotes() bool
- func (t *Todo) Prioritize()
- func (t *Todo) Unarchive()
- func (t *Todo) Uncomplete()
- func (t *Todo) Unprioritize()
- func (t Todo) Valid() bool
- type TodoFilter
- type TodoList
- func (t *TodoList) Add(todo *Todo)
- func (t *TodoList) Archive(ids ...int)
- func (t *TodoList) Complete(ids ...int)
- func (t *TodoList) Delete(ids ...int)
- func (t *TodoList) FindByID(id int) *Todo
- func (t *TodoList) GarbageCollector()
- func (t *TodoList) IndexOf(todoToFind *Todo) int
- func (t *TodoList) Load(todos []*Todo)
- func (t *TodoList) MaxID() int
- func (t *TodoList) NextID() int
- func (t *TodoList) Prioritize(ids ...int)
- func (t *TodoList) SetStatus(status string, ids ...int)
- func (t *TodoList) Todos() []*Todo
- func (t *TodoList) Unarchive(ids ...int)
- func (t *TodoList) Uncomplete(ids ...int)
- func (t *TodoList) Unprioritize(ids ...int)
Constants ¶
const ( VERSION string = "1.0" DATE_FORMAT string = "2006-01-02" )
current version and date format of taskercli
const ( AddEvent = "EventAdded" UpdateEvent = "EventUpdated" DeleteEvent = "EventDeleted" )
the different types of events that can occur
const ( Daily = "daily" Weekdays = "weekdays" Weekly = "weekly" Monthly = "monthly" Yearly = "yearly" )
const TodosJSONFile = ".todos.json"
name of the todo file
Variables ¶
This section is empty.
Functions ¶
func AddIfNotThere ¶
AddIfNotThere is appending an item to an array if the item is not already present.
func UserHomeDir ¶
func UserHomeDir() string
Types ¶
type App ¶
type App struct { EventLogger *EventLogger TodoStore Store Printer Printer TodoList *TodoList }
App is giving the structure of the taskercli
func NewAppWithPrintOptions ¶
NewAppWithPrintOptions creates a new app with options for printing on screen.
func (*App) ArchiveCompleted ¶
func (a *App) ArchiveCompleted()
ArchiveCompleted will archive all completed todos.
func (*App) CompleteTodo ¶
CompleteTodo completes a todo
func (*App) DeleteNote ¶
DeleteNote deletes a note from a todo.
func (*App) DeleteTodo ¶
DeleteTodo deletes a todo from the todo list
func (*App) GarbageCollect ¶
func (a *App) GarbageCollect()
GarbageCollect will delete all archived todos.
func (*App) InitializeRepo ¶
func (a *App) InitializeRepo()
Initialize is initializing the taskercli repo
func (*App) PrioritizeTodo ¶
PrioritizeTodo will prioritize a todo.
func (*App) UnarchiveTodo ¶
UnarchiveTodo unarchives a todo.
func (*App) UncompleteTodo ¶
UncompleteTodo uncompletes a todo.
func (*App) UnprioritizeTodo ¶
UnprioritizeTodo unprioritizes a todo.
type DateParser ¶
type DateParser struct{}
DateParser is a thing that parses relative, arbitrary, and absolute dates, and returns a date in the format of yyyy-mm-dd
type EventLog ¶
type EventLog struct { EventType string `json:"event_type"` ObjectType string `json:"object_type"` TodoListUUID string `json:"todo_list_uuid"` Object *Todo `json:"object"` }
EventLog is a log of events that occurred, with the todo data.
type EventLogger ¶
type EventLogger struct { PreviousTodoList *TodoList CurrentTodoList *TodoList Store Store SyncedLists []*SyncedList CurrentSyncedList *SyncedList Events []*EventLog }
EventLogger is the main struct of this file
func NewEventLogger ¶
func NewEventLogger(todolist *TodoList, store Store) *EventLogger
NewEventLogger is creating a new event logger
type FileStore ¶
type FileStore struct {
Loaded bool
}
FileStore is the struct for the file store
func (*FileStore) GetLocation ¶
GetLocation is getting the location of the .todos.json file
func (*FileStore) Initialize ¶
func (f *FileStore) Initialize()
Initialize is initializing a new .toos.json file
func (*FileStore) Load ¶
Load is loading the todos from the .todos.json file either from the current dir or from the home dir
func (*FileStore) LocalTodosFileExists ¶
Returns true if the .todos.json file exists in the current dir
type Filter ¶
type Filter struct { Subject string Archived bool IsPriority bool Completed bool Due string DueBefore string DueAfter string Contexts []string Projects []string Status []string ExcludeContexts []string ExcludeProjects []string ExcludeStatus []string CompletedAt []string HasCompleted bool HasCompletedAt bool HasArchived bool HasIsPriority bool HasDueBefore bool HasDue bool HasDueAfter bool HasStatus bool HasProjectFilter bool HasContextFilter bool HasRecur bool Recur string RecurUntil string }
func (*Filter) LastStatus ¶
LastStatus returns the last status from the filter
type GroupedTodos ¶
GroupedTodos is the main struct storing the grouped todos
type Grouper ¶
type Grouper struct{}
Grouper is the group struct
func (*Grouper) GroupByContext ¶
func (g *Grouper) GroupByContext(todos []*Todo) *GroupedTodos
GroupByContext is grouping todos by its context.
func (*Grouper) GroupByNothing ¶
func (g *Grouper) GroupByNothing(todos []*Todo) *GroupedTodos
GroupByNothing is the default result if todos are not grouped by context project.
func (*Grouper) GroupByProject ¶
func (g *Grouper) GroupByProject(todos []*Todo) *GroupedTodos
GroupByProject is grouping todos by its project.
func (*Grouper) GroupByStatus ¶
func (g *Grouper) GroupByStatus(todos []*Todo) *GroupedTodos
GroupByStatus is grouping todos by status
type InputParser ¶
type InputParser struct{}
type MemoryPrinter ¶
type MemoryPrinter struct {
Groups *GroupedTodos
}
MemoryPrinter is a printer that prints to the console
func (*MemoryPrinter) Print ¶
func (m *MemoryPrinter) Print(groupedTodos *GroupedTodos, printNotes bool)
Print prints the grouped todo list to the console
type MemoryStore ¶
type MemoryStore struct {
Todos []*Todo
}
MemoryStore is a store that stores the todo list in memory
func NewMemoryStore ¶
func NewMemoryStore() *MemoryStore
NewMemoryStore creates a new MemoryStore that returns a pointer to a new MemoryStore
func (*MemoryStore) GetLocation ¶
func (m *MemoryStore) GetLocation() string
Get Location of the memory store
func (*MemoryStore) Initialize ¶
func (m *MemoryStore) Initialize()
Init initializes the MemoryStore
func (*MemoryStore) Load ¶
func (m *MemoryStore) Load() ([]*Todo, error)
Load loads the todo list from the MemoryStore
func (*MemoryStore) LocalTodosFileExists ¶
func (m *MemoryStore) LocalTodosFileExists() bool
Check if LocalTodoFileExists
func (*MemoryStore) Save ¶
func (m *MemoryStore) Save(todos []*Todo)
Save saves the todo list to the MemoryStore
type Printer ¶
type Printer interface {
Print(*GroupedTodos, bool, bool)
}
Printer is an interface for printing the output of grouped todos
type Recurrence ¶
type Recurrence struct{}
Recurrence struct for recurring todos
func (*Recurrence) HasNextRecurringTodo ¶
func (r *Recurrence) HasNextRecurringTodo(todo *Todo) bool
HasNextRecurringTodo determines if a todo has a next recurrence.
func (*Recurrence) NextRecurringTodo ¶
func (r *Recurrence) NextRecurringTodo(todo *Todo, completedDate time.Time) *Todo
NextRecurringTodo generates the next recurring todo from the one passed in.
func (*Recurrence) ValidRecurrence ¶
func (r *Recurrence) ValidRecurrence(input string) bool
ValidRecurrence takes an input string and determines if the value is a valid tasker recurrence.
type ScreenPrinter ¶
ScreenPrinter is the default struct of this file
func NewScreenPrinter ¶
func NewScreenPrinter(unicodeSupport bool) *ScreenPrinter
NewScreenPrinter creates a new screeen printer.
func (*ScreenPrinter) Print ¶
func (f *ScreenPrinter) Print(groupedTodos *GroupedTodos, printNotes bool, showStatus bool)
Print prints the output of tasker to the terminal screen.
type SimpleScreenPrinter ¶
SimpleScreenPrinter is a printer that prints to the console
func NewSimpleScreenPrinter ¶
func NewSimpleScreenPrinter(unicodeSupport bool) *SimpleScreenPrinter
NewScreenPrinter creates a new screen printer
func (*SimpleScreenPrinter) Print ¶
func (f *SimpleScreenPrinter) Print(groupedTodos *GroupedTodos, printNotes bool, showStatus bool)
Print prints the output to the terminal
type Store ¶
type Store interface { GetLocation() string LocalTodosFileExists() bool Initialize() Load() ([]*Todo, error) Save(todos []*Todo) }
Store is the interface for the taskercli todos.
type SyncedList ¶
type Todo ¶
type Todo struct { ID int `json:"id"` UUID string `json:"uuid"` Subject string `json:"subject"` Projects []string `json:"projects"` Contexts []string `json:"contexts"` Due string `json:"due"` Completed bool `json:"completed"` CompletedDate string `json:"completed_date"` Status string `json:"status"` Archived bool `json:"archived"` IsPriority bool `json:"is_priority"` Notes []string `json:"notes"` Recur string `json:"recur"` RecurUntil string `json:"recur_until"` PrevRecurTodoUUID string `json:"prev_recur_todo_uuid"` }
func AddTodoIfNotThere ¶
AddTodoIfNotThere is appending an todo item to an todo array if the item is not already present.
func CreateTodo ¶
func (Todo) CalculateDueTime ¶
CalculateDueDate calculates the due date for a todo item
func (*Todo) Complete ¶
func (t *Todo) Complete()
Complete marks a todo item as completed with the current time
func (Todo) CompletedDateToDate ¶
CompletedDate returns the completed date of a todo item
func (*Todo) Uncomplete ¶
func (t *Todo) Uncomplete()
type TodoFilter ¶
TodoFilter filters todos based on patterns.
func (*TodoFilter) ApplyFilter ¶
func (f *TodoFilter) ApplyFilter() []*Todo
ApplyFilter filters todos based on the Filter struct passed in.
type TodoList ¶
type TodoList struct { Name string `json:"name"` UUID string `json:"uuid"` Data []*Todo `json:"todo_items_attributes"` }
TodoList is the struct for a todo list with multiple todos.
func (*TodoList) Delete ¶
Delete is a variadic function deleting multiple todos from a todo list by their ids
func (*TodoList) GarbageCollector ¶
func (t *TodoList) GarbageCollector()
GarbageCollector is a function that cleans up the todo list by removing archived todos
func (*TodoList) Prioritize ¶
Prioritize is prioritizing multiple todos by their ids from todo list
func (*TodoList) SetStatus ¶
SetStatus is setting the status of multiple todos by their ids from todo list along with the status
func (*TodoList) Uncomplete ¶
Uncomplete is a variadic function uncompleting multiple todos by their ids
func (*TodoList) Unprioritize ¶
Unprioritize is unprioritizing multiple todos by their ids from todo list