tasktree

package
v0.47.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package tasktree draws every task tree f10 prints: a row per task on box-drawing lines down each After: chain, and under a row its title and labelled notes. Skills relay this output verbatim instead of drawing the glyphs themselves, so a tree reads the same wherever it is shown.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cut

func Cut(s string, n int) string

Cut shortens s to n columns, an ellipsis marking the cut.

Types

type Cell

type Cell struct {
	Text   string
	Render func(text string) string
}

A Cell is one column of a row. Text is what is measured and padded; Render, when set, is what prints in its place (color, a link), so escape sequences never count as columns.

type Node

type Node struct {
	Depth int
	Cells []Cell // the first is the task's id
	Title string
	Notes []Note
}

A Node is one task. Depth 0 is the top level; a node one deeper than the node before it hangs under that node.

type Note

type Note struct {
	Label string
	Text  string
	Whole bool
}

A Note is a labelled line under a row: an ask, a halt, a gate. Whole keeps it uncut, for text a reader acts on (a url, a question).

type Tree

type Tree struct {
	// Head prints first, alone, and the top-level nodes hang under it.
	Head string
	// Indent goes before every line but Head.
	Indent string
	// Hang draws glyphs on the top-level nodes too, as if under a Head.
	Hang bool
	// Align pads each column to its widest cell; otherwise the cells of a
	// row are joined by two spaces, empty ones skipped.
	Align bool
	// Width cuts titles and notes to fit it; 0 is no limit.
	Width int
	// Label renders a note's label; nil prints it as is.
	Label func(string) string
}

A Tree is how the nodes print.

func (Tree) Write

func (t Tree) Write(w io.Writer, nodes []Node) error

Write prints the nodes, an empty list printing nothing but Head.

Jump to

Keyboard shortcuts

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