tuido

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2025 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Open     status = "open"
	Ongoing  status = "ongoing"
	Checked  status = "checked"
	Obsolete status = "obsolete"
)

Variables

This section is empty.

Functions

func IsTuido

func IsTuido(raw string) bool

IsTuido inspects a raw string for parsibility into a tuido item. It relaxes the [x]it spec in the following ways:

  • leading whitespace is allowed
  • markdown style bulleted items are allowed
  • golang inline "//" comments are parsed for items

[ ] unit #test this w/ a bunch of expected passes & failures [ ] #maybe allow numbered md lists (1. [ ] ...) [ ] #maybe include a language map for code-comment parsing. ie, {".rb": "#", ".go": "//"} [ ] ! #maybe require a file extension for this fcn. Allows for PL specific rules, as well as md

func ToDuration added in v0.0.5

func ToDuration(dStr string) *time.Duration

ToDuration parses duration shorthands like

  • 16h (16 hours)
  • 3d (three days)
  • 12w (twelve weeks)
  • 2m (two months)
  • 1y (one year)

into time.Durations structs of that duration.

Note, 1m from now will producea different durations depending on the current month

[ ] #test #parsing

Types

type Item

type Item struct {
	// contains filtered or unexported fields
}

func New

func New(
	file string,
	line int,
	raw string,
) Item

func (Item) Active

func (i Item) Active() bool

Active returns the "active" status for snoozed items. Items with `active` tags later than the current date will not be shown in the regular view. Defaults to true.

func (Item) Created

func (i Item) Created() *time.Time

func (*Item) Deescalate added in v0.0.3

func (i *Item) Deescalate() error

Deescalate decreases the "importance" of an item by removing a leading exclamation mark.

NB: deescalate is not up to [x]it spec wrt items prefixed with

both periods and exclamations, and will fail to deescalate,
eg, "..!!! do this"

[ ] make [x]it spec compliant [ ] wants unit tests

func (Item) Due

func (i Item) Due() *time.Time

func (*Item) Escalate

func (i *Item) Escalate() error

Escalate increases the "importance" of an item by prefixing it with an exclamation point.

func (*Item) GetContext added in v0.0.5

func (i *Item) GetContext(height int) (string, int)

GetContext reads and returns some surrounding text from the item's source file.

The returned integer is the line number of the item's text inside the returned context.

func (Item) Importance

func (i Item) Importance() int

Importance returns the number of leading '!'s in the item's Text.

func (*Item) IncrementTimeSpent added in v0.0.5

func (i *Item) IncrementTimeSpent(seconds int)

func (*Item) Location

func (i *Item) Location() string

func (Item) Repeat

func (i Item) Repeat() *time.Duration

func (Item) Satus

func (i Item) Satus() status

Status returns the status of the item. One of:

  • open (ie, noted but not begun)
  • ongoing (ie, in progress)
  • checked (ie, completed)
  • obsolete (ie, no longer necessary)

func (*Item) SetStatus

func (i *Item) SetStatus(s status) error

SetStatus writes the updated status to the item's file on disk and updates the status of the in-memory item.

If the disk write fails, the in-memory update is abandoned.

func (*Item) SetText

func (i *Item) SetText(t string) error

SetText writes the updated text to the item's file on disk and updates the text of the in-memory item.

If the disk write fails, the in-memory update is abandoned.

func (*Item) Snooze

func (i *Item) Snooze() error

func (Item) String

func (i Item) String() string

String returns the item status box plus body text. EG, for the item

  • [x] this one

String() returns "[x] this one"

func (Item) Tags

func (i Item) Tags() []Tag

func (Item) Text

func (i Item) Text() string

Text returns the item's body text. EG, for item

  • [x] this one is done

the Text() is "this one is done"

type Tag

type Tag struct {
	// contains filtered or unexported fields
}

func NewTag added in v0.0.13

func NewTag(s string) Tag

NewTag splits a string token "#name=value" into a Tag struct.

func Tags

func Tags(s string) []Tag

func (Tag) Name

func (t Tag) Name() string

func (Tag) String

func (t Tag) String() string

Jump to

Keyboard shortcuts

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