todo

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TimeFormat     = "2006-01-02"
	DateTimeFormat = "2006-01-02 15:04:05"
	DateFormat     = "2006-01-02"
	CompletedChar  = "✅ "
	OpenedChar     = ""
	PendingChar    = "⌛"
	ClockChar      = "⏱"
)
View Source
const BackupFilePrefix = "todo_backup"

Variables

This section is empty.

Functions

func EqualTags added in v0.1.0

func EqualTags(tags1 []string, tags2 []string) bool

func NewItemId

func NewItemId() string

func ParseTags added in v0.1.0

func ParseTags(tags []string) []string

func SortList

func SortList(list []*Item)

Types

type Collection added in v0.1.0

type Collection struct {
	Items        map[string]*Item `yaml:"items"`
	DeletedItems []string         `yaml:"deleted_items"`
	LastUpdate   time.Time        `yaml:"last_update"`
	LastSave     time.Time        `yaml:"last_save"`
	LastSync     time.Time        `yaml:"last_sync"`
}

func LoadFromData added in v0.1.0

func LoadFromData(data []byte) (collection Collection, err error)

func LoadFromFile added in v0.1.0

func LoadFromFile(filename string) (collection Collection, err error)

func NewTodoCollection

func NewTodoCollection() *Collection

func (*Collection) Add added in v0.1.0

func (collection *Collection) Add(item *Item)

func (*Collection) Backup added in v0.1.0

func (c *Collection) Backup(cfg *config.BackupConfig) (err error)

Backup creates a backup of the collection file

func (*Collection) BackupPrefix added in v0.1.0

func (c *Collection) BackupPrefix() string

func (*Collection) Complete added in v0.1.0

func (collection *Collection) Complete(index int, undo bool, recursive bool) error

func (*Collection) DoAct added in v0.1.0

func (collection *Collection) DoAct(index int) error

func (*Collection) Equal added in v0.1.0

func (c *Collection) Equal(other any) bool

func (*Collection) Get added in v0.1.0

func (collection *Collection) Get(index int) *Item

func (*Collection) GetByFilter added in v0.1.0

func (collection *Collection) GetByFilter(tags []string, justCompleted bool, justPending bool) []*Item

func (*Collection) GetChildren added in v0.1.0

func (collection *Collection) GetChildren(id string) []*Item

func (*Collection) GetTreeList added in v0.1.0

func (collection *Collection) GetTreeList(items []*Item) []string

func (*Collection) GetTreeView added in v0.1.0

func (collection *Collection) GetTreeView(items []*Item) []string

func (*Collection) ListBackup added in v0.1.0

func (c *Collection) ListBackup(cfg *config.BackupConfig) ([]string, error)

func (*Collection) Merge added in v0.1.0

func (collection *Collection) Merge(other *Collection) (log []string, diffCount int, upload bool)

func (*Collection) Parse added in v0.1.0

func (c *Collection) Parse(data []byte) error

func (*Collection) ParseNew added in v0.1.0

func (c *Collection) ParseNew(data []byte) (interfaces.Backupable, error)

func (*Collection) Remove added in v0.1.0

func (collection *Collection) Remove(index int) error

func (*Collection) Save added in v0.1.0

func (collection *Collection) Save(filename string) (err error)

func (*Collection) Sorted added in v0.1.0

func (collection *Collection) Sorted() (items []*Item)

func (*Collection) UpdateLevels added in v0.1.0

func (collection *Collection) UpdateLevels()

type Item added in v0.1.0

type Item struct {
	Id         string    `yaml:"id"`
	Index      int       `yaml:"index"`
	Title      string    `yaml:"title"`
	Completed  bool      `yaml:"completed"`
	DueTo      time.Time `yaml:"due_to"`
	LastAction time.Time `yaml:"last_action"`
	Tags       []string  `yaml:"tags"`
	UpdatedAt  time.Time `yaml:"updated_at"`
	ParentId   string    `yaml:"parent_id"`
	Deleted    bool      `yaml:"-"`
	Level      int       `yaml:"level"`
}

func MergeCollections

func MergeCollections(col1 []*Item, col2 []*Item) (newCol []*Item, deleted_items []string, log []string, diffCount int, upload bool)

func (*Item) Equal added in v0.1.0

func (i *Item) Equal(other *Item) bool

func (*Item) ItemColor added in v0.1.0

func (item *Item) ItemColor() func(any) string

func (*Item) LevelString added in v0.1.0

func (item *Item) LevelString(level int) string

func (*Item) NotifyText added in v0.1.0

func (item *Item) NotifyText() string

func (*Item) SetTags added in v0.1.0

func (i *Item) SetTags(tags []string)

func (*Item) String added in v0.1.0

func (item *Item) String() string

func (*Item) StringNoColor added in v0.1.0

func (item *Item) StringNoColor() string

Jump to

Keyboard shortcuts

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