diff --git a/checklist/checklist_item.go b/checklist/checklist_item.go index e574ba92..40cfafb8 100644 --- a/checklist/checklist_item.go +++ b/checklist/checklist_item.go @@ -24,6 +24,8 @@ func NewChecklistItem(checked bool, text string, checkedIcon, uncheckedIcon stri // CheckMark returns the string used to indicate a ChecklistItem is checked or unchecked func (item *ChecklistItem) CheckMark() string { + item.ensureItemIcons() + if item.Checked { return item.CheckedIcon } @@ -36,3 +38,15 @@ func (item *ChecklistItem) CheckMark() string { func (item *ChecklistItem) Toggle() { item.Checked = !item.Checked } + +/* -------------------- Unexported Functions -------------------- */ + +func (item *ChecklistItem) ensureItemIcons() { + if item.CheckedIcon == "" { + item.CheckedIcon = "x" + } + + if item.UncheckedIcon == "" { + item.UncheckedIcon = " " + } +}