Documentation ¶
Overview ¶
Package todos handles creation of TODO files and adding and completting todos.
Index ¶
- func Init(dirPath string) (string, error)
- type TodoFile
- func (t *TodoFile) Accomplish(i int) error
- func (t *TodoFile) Add(text string) error
- func (t TodoFile) Create() (string, error)
- func (t *TodoFile) Dir() (string, error)
- func (t *TodoFile) FindPrev() (TodoFile, error)
- func (t *TodoFile) Path() (string, error)
- func (t *TodoFile) Print()
- func (t *TodoFile) Read() (int, error)
- func (t *TodoFile) Write() (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type TodoFile ¶
type TodoFile struct { Todos []string Accomps []string Year string Month string Day string Content string BasePath string }
TodoFile stores the data of a to-do file and has the relevant methods to interact with it.
func NewTodoFile ¶
NewTodoFile creates a new TodoFile with path as the TD's base path.
func (*TodoFile) Accomplish ¶
Accomplish moves a TODO to the Accomplished list.
func (TodoFile) Create ¶
Create creates a todo file at "<t.BasePath>/<t.Year>/<t.Month>/<t.Day>". Asumes TD's base path has already been created.
func (*TodoFile) Dir ¶
Dir returns the TodoFile directory path ("<base-path>/<year>/<month>"). If t.Year and/or t.Month are missing, they will first be assigend to the current year/month.
func (*TodoFile) Path ¶
Path returns the TodoFile path ("<base-path>/<year>/<month>/<day>.txt"). If t.Year, t.Month and t.Day are missing, they will assigend first to the current date.
func (*TodoFile) Print ¶
func (t *TodoFile) Print()
Print prints the TodoFile TODO & Accomplished lists.