taskinput

package
v0.0.0-...-2097cc5 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Unparse

func Unparse(t Task) string

func UpdateToken

func UpdateToken(t *Task, idx int, newRaw string, now time.Time)

Replaces a token's raw text and updates spans of subsequent tokens. Caller passes token index and new raw string (e.g., "@2026-04-20"). This is used to reflect changes in th tokens themselves i.e. via form fields back into the string

Types

type Span

type Span struct {
	Start int
	End   int
}

type Task

type Task struct {
	Title      string
	Structured string
	Tokens     []Token

	// resolved fields (derived)
	Due       *time.Time
	Scheduled *time.Time
	Important bool
	Next      bool
}

func Parse

func Parse(input string, now time.Time) Task

type Token

type Token struct {
	Kind  TokenKind
	Raw   string
	Value string
	Span  Span
}

type TokenKind

type TokenKind int
const (
	TokenRaw       TokenKind = iota
	TokenScheduled           // @date
	TokenDue                 // ^date
	TokenImportant           // !
	TokenNext                // >
)

Jump to

Keyboard shortcuts

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