itashi

package
v0.0.0-...-517c22b Latest Latest
Warning

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

Go to latest
Published: May 26, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const AUTUMN_EQUINOX = 265
View Source
const FS_SAVE_LOCATION = "./todo.ta"
View Source
const HEADER_TEMPLATE = `` /* 257-byte string literal not displayed */
View Source
const SHELF_COL_DELIM = "    "
View Source
const SHELF_LINE_DELIM = "\n----    ----    ----    ----\n"
View Source
const SHELF_TEMPLATE = "{{.Id}}    {{.Title}}    {{.Desc}}    {{.Due}}    {{.Done}}    {{.Priority}}"
View Source
const SPRING_EQUINOX = 81
View Source
const SUMMER_SOLSTICE = 173
View Source
const TASK_ITEM = `` /* 190-byte string literal not displayed */
View Source
const TIME_FORMAT = "2006-01-02T15:04:05 -07:00:00"
View Source
const TIME_TO_TEMPLATE = `{{.Hours}}H, {{.Minutes}}M`
View Source
const WINTER_SOLSTICE = 356

Variables

Functions

func AddTaskPrompt

func AddTaskPrompt(shelf TaskShelf)

Add task to the shelf

func GetDefualtSave

func GetDefualtSave() string

func GetTaskNames

func GetTaskNames(t []Task) []string

Grab all of the names of the tasks from the TaskShelf

    :param t: a list of Task structs
	:returns: A list of the task names

func InitialModel

func InitialModel() model

Types

type FilesystemShelf

type FilesystemShelf struct {
	SaveLocation string
	Template     *template.Template
	TaskTempl    *template.Template
	Tasks        []Task
}

func NewFilesystemShelf

func NewFilesystemShelf(save string) *FilesystemShelf

Create a new filesystem shelf struct to reflect the filesystem shelf

    :param save: the save location to store the shelf in
	:returns: a pointer to a FilesystemShelf struct

func (*FilesystemShelf) AddTask

func (f *FilesystemShelf) AddTask(title string, desc string, priority int, due time.Time)

Add a task to the filesystem shelf

    :param title: the title to give the task
	:param desc: the description to give the task
	:param priority: the priority to give the task
	:param due: the due date for the task
	:returns: Nothing

func (*FilesystemShelf) Clean

func (f *FilesystemShelf) Clean() int

Clean the filesystem shelf of all completed tasks

func (*FilesystemShelf) DeleteTask

func (f *FilesystemShelf) DeleteTask(id int)

func (*FilesystemShelf) GetAll

func (f *FilesystemShelf) GetAll() []Task

Retrieve all the tasks from the filesystem shelf

func (*FilesystemShelf) MarkDone

func (f *FilesystemShelf) MarkDone(id int) string

Mark task as done and write the shelf to disk. since the Tasks within FilesystemShelf are values and not pointers, we need to copy the entirety of the shelf over to a new set and write it, as opposed to just modifying the pointer and then writing.

    :param id: the ID of the task to mark as done
	:returns: Nothing

func (*FilesystemShelf) ModifyDesc

func (f *FilesystemShelf) ModifyDesc(id int, desc string)

func (*FilesystemShelf) ModifyDue

func (f *FilesystemShelf) ModifyDue(id int, due time.Time)

Boiler plate so i can implement later

func (*FilesystemShelf) ModifyPriority

func (f *FilesystemShelf) ModifyPriority(id int, pri int)

func (*FilesystemShelf) ModifyTitle

func (f *FilesystemShelf) ModifyTitle(id int, title string)

func (*FilesystemShelf) RenderTask

func (t *FilesystemShelf) RenderTask(task Task) string

func (*FilesystemShelf) ResetDone

func (f *FilesystemShelf) ResetDone(id int)

type HeaderData

type HeaderData struct {
	Date          string
	Season        string
	DaysToQuarter int
	QuarterType   string
	DayOfWeek     string
	Time          string
	Meridiem      string
	TtEod         TimeToSunShift
	TtSun         TimeToSunShift
	SunCycle      string
}

type Option

type Option struct {
	Name     string             // the display name in the UI
	Template *template.Template // The template to render in the Render() func

}

func GetOptions

func GetOptions() []Option

Removing this from GetShelfHome to allow for indirecting the data feed

func (Option) Render

func (o Option) Render() string

Render the template stored in the Template struct field

type ShelfHome

type ShelfHome struct {
	Items     []Option
	Tasks     TaskShelf
	TaskTempl *template.Template
}

func GetShelfHome

func GetShelfHome(save string) ShelfHome

Create the task shelf homepage

func (ShelfHome) OptionList

func (s ShelfHome) OptionList() []string

Return a list of the options as strings for the UI to render

type Task

type Task struct {
	Id       int
	Title    string
	Desc     string
	Due      time.Time
	Done     bool
	Priority int
}

func GetTaskList

func GetTaskList(taskio TaskShelf) []Task

Retrieve all the tasks from the designated TaskShelf

func (Task) Init

func (t Task) Init() tea.Cmd

lets make Task implement the tea.Model interface

func (Task) Update

func (t Task) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Task) View

func (t Task) View() string

type TaskShelf

type TaskShelf interface {
	// Modify the due date of an existing task
	ModifyDue(id int, due time.Time)
	// Modify the description field of an existing task
	ModifyDesc(id int, desc string)
	// Modify the priority of an existing task
	ModifyPriority(id int, pri int)
	// modify the title of an existing task
	ModifyTitle(id int, title string)
	// delete an existing task from the shelf
	DeleteTask(id int)
	// Mark a task as complete
	MarkDone(id int) string
	// hopefully you dont need to call this! ;)
	ResetDone(id int)
	// Add a task to the shelf
	AddTask(title string, desc string, priority int, due time.Time)
	// Retrieve all tasks in the shelf
	GetAll() []Task
	// Render a task to a task template
	RenderTask(task Task) string
	// Clean the shelf of all completed tasks
	Clean() int
}

type TimeToSunShift

type TimeToSunShift struct {
	Hours   int
	Minutes int
}

type UserDetails

type UserDetails interface {
	// contains filtered or unexported methods
}

type UserImplementation

type UserImplementation struct{}

Jump to

Keyboard shortcuts

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