render

package
v0.70.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package render is the output layer every command shares: the facts block, task links and hyperlinks, and the pager.

Index

Constants

This section is empty.

Variables

View Source
var LinkTerminal = ui.IsTerminal

LinkTerminal is swapped in tests, which write to a buffer.

Functions

func FileLink(path string) string

FileLink links a markdown path to its file:// url, its text left as the path since people copy it; other files stay plain, as only markdown has a handler to open it.

func FileURL

func FileURL(path string) string

FileURL is the absolute file:// url of a markdown path, else empty.

func Follow

func Follow(ctx context.Context, w io.Writer, dir, url string, linkOnly bool) error

Follow acts on a url a driver returned; drivers only return addresses.

func Hyperlink(url, text string) string

Hyperlink is an OSC 8 link, which a terminal without support shows as text.

func LabelWidth

func LabelWidth(rows []Fact) int

LabelWidth is the label column rows need, the colon included.

func LinkFlag

func LinkFlag() cli.Flag

LinkFlag is the same flag on every verb that follows an address, so `open` keeps one meaning across nouns whose addresses are paths and urls alike.

func PadRight

func PadRight(s string, width int) string

PadRight pads s to width visible columns, which %-*s gets wrong for a link.

func PrintFlag

func PrintFlag() cli.Flag

func VisibleWidth

func VisibleWidth(s string) int

VisibleWidth is the columns s takes on screen, its links' escapes not counted.

func Wrap

func Wrap(text string, width int) []string

Wrap breaks text at spaces; width 0 or below disables it, and a token longer than the width is hard-cut rather than overflowed.

func WriteDoc

func WriteDoc(ctx context.Context, w io.Writer, dir, doc string) error

WriteDoc pages markdown on a terminal and writes it raw to a pipe: no renderer is bundled, since glow, bat or an editor compose for free.

func WriteFacts

func WriteFacts(w io.Writer, rows []Fact, width, limit int) error

WriteFacts prints rows as `label: <marker> value`, labels padded to width, so rows printed apart with one width still share a value column.

func WriteReport

func WriteReport(w io.Writer, rows []Fact, notes []string) error

WriteReport prints the facts block as conventions/report.md fixes it; notes follow as prose beneath.

Types

type Fact

type Fact struct {
	Label string
	Value string
	URL   bool
	Path  bool // a markdown file, linked on a terminal; the marker stays blank

	// Run marks a run row: its value takes style and wraps at the page width.
	// A facts value does neither, since its link escapes would be cut apart.
	Run   bool
	Style lipgloss.Style
}

func TaskFact

func TaskFact(ctx context.Context, w io.Writer, dir, id string) Fact

TaskFact is a report's task row, a bundle's ids linked one by one.

type LinkBuffer

type LinkBuffer struct {
	bytes.Buffer

	Links bool
}

LinkBuffer holds output its caller copies on to another writer, so it links when that writer would.

func (*LinkBuffer) Terminal

func (b *LinkBuffer) Terminal() bool

Terminal makes the buffer read as the writer it is copied on to.

type TaskLinks struct {
	On bool
	// contains filtered or unexported fields
}

TaskLinks prints task ids for people: an id becomes a terminal link when linking is on and its url is known. Urls come from the ledger only, so no command waits on the tracker to print. A nil one prints every id plain.

func LinksFor

func LinksFor(w io.Writer, plain bool) *TaskLinks

LinksFor links only on a terminal: piped output, --plain and --json are parsed by agents and scripts, which escape codes would break.

func LinksOn

func LinksOn(on bool) *TaskLinks

func (*TaskLinks) ID

func (l *TaskLinks) ID(project, id string) string

ID is id as printed for people; a bundle links each member on its own.

func (*TaskLinks) Known

func (l *TaskLinks) Known(project, id, url string)

Known records a url the caller already holds, so it needs no ledger read.

func (*TaskLinks) Load

func (l *TaskLinks) Load(ctx context.Context, project string, ids ...string)

Load reads the urls the ledger holds for ids under project, in one query. The ledger is never opened when linking is off.

func (*TaskLinks) LoadAs

func (l *TaskLinks) LoadAs(ctx context.Context, project, key string, ids ...string)

LoadAs is Load for a caller that names the project by key rather than by its ledger project, as standup does by project name.

func (*TaskLinks) URL added in v0.62.0

func (l *TaskLinks) URL(project, id string) string

URL is the url known for id under project, "" for none.

Jump to

Keyboard shortcuts

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