Documentation ¶
Index ¶
- type Checklist
- func (list *Checklist) Add(checked bool, date *time.Time, text string, newPos ...string)
- func (list *Checklist) CheckedItems() []*ChecklistItem
- func (list *Checklist) Delete(selectedIndex int)
- func (list *Checklist) IndexByItem(selectableItem *ChecklistItem) (index int, ok bool)
- func (list *Checklist) IsSelectable() bool
- func (list *Checklist) IsUnselectable() bool
- func (list *Checklist) Len() int
- func (list *Checklist) Less(i, j int) bool
- func (list *Checklist) LongestLine() int
- func (list *Checklist) Swap(i, j int)
- func (list *Checklist) UncheckedItems() []*ChecklistItem
- func (list *Checklist) Unselect()
- type ChecklistItem
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 (*Checklist) Add ¶
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) IndexByItem ¶ added in v0.24.0
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 ¶
IsSelectable returns true if the checklist has selectable items, false if it does not
func (*Checklist) IsUnselectable ¶
IsUnselectable returns true if the checklist has no selectable items, false if it does
func (*Checklist) LongestLine ¶
LongestLine returns the length of the longest checklist item's text
func (*Checklist) UncheckedItems ¶
func (list *Checklist) UncheckedItems() []*ChecklistItem
UncheckedItems returns a slice of all the unchecked items
type ChecklistItem ¶
type ChecklistItem struct { Checked bool CheckedIcon string Date *time.Time Text string UncheckedIcon string }
ChecklistItem is a module for creating generic checklist implementations See 'Todo' for an implementation example
func NewChecklistItem ¶
func (*ChecklistItem) CheckMark ¶
func (item *ChecklistItem) CheckMark() string
CheckMark returns the string used to indicate a ChecklistItem is checked or unchecked
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