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) GarbageCollect()
- 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(input 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.7.0" DATE_FORMAT string = "2006-01-02" )
Current version of ultralist.
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"
TodosJSONFile is the filename to store todos in
Variables ¶
This section is empty.
Functions ¶
func AddIfNotThere ¶
AddIfNotThere is appending an item to an array if the item is not already present.
Types ¶
type App ¶
type App struct { EventLogger *EventLogger TodoStore Store Printer Printer TodoList *TodoList }
App is the giving you the structure of the ultralist app.
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) GarbageCollect ¶
func (a *App) GarbageCollect()
GarbageCollect will delete all archived todos.
func (*App) InitializeRepo ¶
func (a *App) InitializeRepo()
InitializeRepo is initializing ultralist 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.
func (*EventLogger) ClearEventLogs ¶
func (e *EventLogger) ClearEventLogs()
ClearEventLogs is clearing the event logs and writes it to disk.
func (*EventLogger) CreateEventLogs ¶
func (e *EventLogger) CreateEventLogs()
CreateEventLogs makes event logs.
func (*EventLogger) DeleteCurrentSyncedList ¶
func (e *EventLogger) DeleteCurrentSyncedList()
DeleteCurrentSyncedList - delete a synced list from the synced_lists.json file
func (*EventLogger) ProcessEvents ¶
func (e *EventLogger) ProcessEvents()
ProcessEvents processes all events that occurred when ultralist ran and write them to a log file.
func (*EventLogger) WriteEventLogs ¶
func (e *EventLogger) WriteEventLogs()
WriteEventLogs writes event logs to disk.
func (*EventLogger) WriteSyncedLists ¶
func (e *EventLogger) WriteSyncedLists()
WriteSyncedLists is writing a synced list.
type FileStore ¶
type FileStore struct {
Loaded bool
}
FileStore is the main struct of this file.
func (*FileStore) GetLocation ¶
GetLocation is returning the location of the .todos.json file.
func (*FileStore) Initialize ¶
func (f *FileStore) Initialize()
Initialize is initializing a new .todos.json file.
func (*FileStore) LocalTodosFileExists ¶
Returns if a local .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 }
Filter holds the parsed filtering results from an input string
func (*Filter) LastStatus ¶
LastStatus returns the last status from the filter
type GroupedTodos ¶
GroupedTodos is the main struct of this file.
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 MemoryPrinter ¶
type MemoryPrinter struct {
Groups *GroupedTodos
}
MemoryPrinter is the main struct of this file.
func (*MemoryPrinter) Print ¶
func (m *MemoryPrinter) Print(groupedTodos *GroupedTodos, printNotes bool)
Print is printing grouped todos.
type MemoryStore ¶
type MemoryStore struct {
Todos []*Todo
}
MemoryStore is the main struct of this file.
func NewMemoryStore ¶
func NewMemoryStore() *MemoryStore
NewMemoryStore is starting new memory store.
func (*MemoryStore) GetLocation ¶
func (m *MemoryStore) GetLocation() string
GetLocation is giving the location of the memory store.
func (*MemoryStore) Initialize ¶
func (m *MemoryStore) Initialize()
Initialize is initializing a new memory store.
func (*MemoryStore) Load ¶
func (m *MemoryStore) Load() ([]*Todo, error)
Load is loading todos from the memory store.
func (*MemoryStore) LocalTodosFileExists ¶
func (m *MemoryStore) LocalTodosFileExists() bool
func (*MemoryStore) Save ¶
func (m *MemoryStore) Save(todos []*Todo)
Save is saving todos to the memory store.
type Printer ¶
type Printer interface {
Print(*GroupedTodos, bool, bool)
}
Printer is an interface for printing grouped todos.
type Recurrence ¶
type Recurrence struct{}
Recurrence struct contains the logic for dealing with 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 ultralist 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 ultralist to the terminal screen.
type SimpleScreenPrinter ¶
ScreenPrinter is the default struct of this file
func NewSimpleScreenPrinter ¶
func NewSimpleScreenPrinter(unicodeSupport bool) *SimpleScreenPrinter
NewScreenPrinter creates a new screeen printer.
func (*SimpleScreenPrinter) Print ¶
func (f *SimpleScreenPrinter) Print(groupedTodos *GroupedTodos, printNotes bool, showStatus bool)
Print prints the output of ultralist to the terminal screen.
type Store ¶
type Store interface { GetLocation() string LocalTodosFileExists() bool Initialize() Load() ([]*Todo, error) Save(todos []*Todo) }
Store is the interface for ultralist todos.
type SyncedList ¶
type SyncedList struct { Filename string `json:"filename"` UUID string `json:"uuid"` Name string `json:"name"` Events []*EventLog `json:"events"` }
SyncedList is a representation of a todolist for syncing.
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"` }
Todo is the struct for a todo item.
func AddTodoIfNotThere ¶
AddTodoIfNotThere is appending an todo item to an todo array if the item is not already present.
func CreateTodo ¶
CreateTodo will create a TodoItem from a Filter
func (Todo) CalculateDueTime ¶
CalculateDueTime is calculating the due time of the todo item.
func (*Todo) Complete ¶
func (t *Todo) Complete()
Complete is completing a todo item and sets the complete date to the current time.
func (Todo) CompletedDateToDate ¶
CompletedDateToDate is returning the date when an item was completed.
func (*Todo) Uncomplete ¶
func (t *Todo) Uncomplete()
Uncomplete is uncompleting a todo item and removes the complete date.
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"` IsSynced bool Data []*Todo `json:"todo_items_attributes"` }
TodoList is the struct of a list with several todos.
func (*TodoList) GarbageCollect ¶
func (t *TodoList) GarbageCollect()
GarbageCollect deletes todos which are archived.
func (*TodoList) Prioritize ¶
Prioritize is prioritizing multiple todos from a todo list.
func (*TodoList) Uncomplete ¶
Uncomplete is uncompleting multiple todos from a todo list.
func (*TodoList) Unprioritize ¶
Unprioritize is unprioritizing multiple todos from a todo list.