Documentation
¶
Index ¶
- Constants
- func IsTuido(raw string) bool
- func ToDuration(dStr string) *time.Duration
- type Item
- func (i Item) Active() bool
- func (i Item) Created() *time.Time
- func (i *Item) Deescalate() error
- func (i Item) Due() *time.Time
- func (i *Item) Escalate() error
- func (i *Item) GetContext(height int) (string, int)
- func (i Item) Importance() int
- func (i *Item) IncrementTimeSpent(seconds int)
- func (i *Item) Location() string
- func (i Item) Repeat() *time.Duration
- func (i Item) Satus() status
- func (i *Item) SetStatus(s status) error
- func (i *Item) SetText(t string) error
- func (i *Item) Snooze() error
- func (i Item) String() string
- func (i Item) Tags() []Tag
- func (i Item) Text() string
- type Tag
Constants ¶
const ( Open status = "open" Ongoing status = "ongoing" Checked status = "checked" Obsolete status = "obsolete" )
Variables ¶
This section is empty.
Functions ¶
func IsTuido ¶
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
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 (Item) Active ¶
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) Deescalate ¶ added in v0.0.3
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) Escalate ¶
Escalate increases the "importance" of an item by prefixing it with an exclamation point.
func (*Item) GetContext ¶ added in v0.0.5
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 ¶
Importance returns the number of leading '!'s in the item's Text.
func (*Item) IncrementTimeSpent ¶ added in v0.0.5
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 ¶
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 ¶
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.