checklist

package
v0.0.0-...-9c5270f Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checklist

type Checklist struct {
	Items []*ChecklistItem
	// contains filtered or unexported fields
}

Checklist is a module for creating generic checklist implementations See 'Todo' for an implementation example

func NewChecklist

func NewChecklist(checkedIcon, uncheckedIcon string) Checklist

func (*Checklist) Add

func (list *Checklist) Add(checked bool, date *time.Time, tags []string, text string, newPos ...string)

Add creates a new checklist item and adds it to the list The new one is at the start or end of the list, based on newPos

func (*Checklist) CheckedItems

func (list *Checklist) CheckedItems() []*ChecklistItem

CheckedItems returns a slice of all the checked items

func (*Checklist) Delete

func (list *Checklist) Delete(selectedIndex int)

Delete removes the selected item from the checklist

func (*Checklist) IndexByItem

func (list *Checklist) IndexByItem(selectableItem *ChecklistItem) (index int, ok bool)

IndexByItem returns the index of a giving item if found, otherwise returns 0 with ok set to false

func (*Checklist) IsSelectable

func (list *Checklist) IsSelectable() bool

IsSelectable returns true if the checklist has selectable items, false if it does not

func (*Checklist) IsUnselectable

func (list *Checklist) IsUnselectable() bool

IsUnselectable returns true if the checklist has no selectable items, false if it does

func (*Checklist) Len

func (list *Checklist) Len() int

func (*Checklist) Less

func (list *Checklist) Less(i, j int) bool

func (*Checklist) LongestLine

func (list *Checklist) LongestLine() int

LongestLine returns the length of the longest checklist item's text

func (*Checklist) Swap

func (list *Checklist) Swap(i, j int)

func (*Checklist) UncheckedItems

func (list *Checklist) UncheckedItems() []*ChecklistItem

UncheckedItems returns a slice of all the unchecked items

func (*Checklist) Unselect

func (list *Checklist) Unselect()

Unselect removes the current select such that no item is selected

type ChecklistItem

type ChecklistItem struct {
	Checked       bool
	CheckedIcon   string `yaml:"-"`
	Date          *time.Time
	Tags          []string
	Text          string
	UncheckedIcon string `yaml:"-"`
}

ChecklistItem is a module for creating generic checklist implementations See 'Todo' for an implementation example

func NewChecklistItem

func NewChecklistItem(checked bool, date *time.Time, tags []string, text string, checkedIcon, uncheckedIcon string) *ChecklistItem

func (*ChecklistItem) CheckMark

func (item *ChecklistItem) CheckMark() string

CheckMark returns the string used to indicate a ChecklistItem is checked or unchecked

func (*ChecklistItem) EditText

func (item *ChecklistItem) EditText() string

EditText returns the content of the edit todo form, so includes formatted date and tags

func (*ChecklistItem) TagString

func (item *ChecklistItem) TagString() string

func (*ChecklistItem) Toggle

func (item *ChecklistItem) Toggle()

Toggle changes the checked state of the ChecklistItem If checked, it is unchecked. If unchecked, it is checked

Jump to

Keyboard shortcuts

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