textx

package
v0.65.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 4 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 textx holds the small text helpers every command shares, so a column is cut, an empty value is marked and an age is spelled one way.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Age

func Age(now, then time.Time) string

Age is a duration read at a glance: seconds under a minute, then the largest whole unit that fits (12m, 5h, 3d). A future time is 0s.

func AppendNote

func AppendNote(notes []string, note string) []string

AppendNote appends note unless it is empty.

func Cut

func Cut(s string, n int) string

Cut shortens s to n terminal columns, an ellipsis marking the cut. Columns, not bytes or runes, because a wide character takes two. An n below 1 leaves s whole, since a caller with no width has no limit.

func FirstLine

func FirstLine(s string) string

FirstLine is s up to its first newline.

func JoinAnd added in v0.65.0

func JoinAnd(items []string) string

JoinAnd joins items as a sentence does: "a", "a and b", "a, b and c".

func JoinOr added in v0.65.0

func JoinOr(items []string) string

JoinOr joins items as a question does: "a", "a or b", "a, b or c".

func OrDash

func OrDash(s string) string

OrDash marks an empty value, so a column never collapses.

func Plural

func Plural(n int, one, many string) string

Plural is one for a count of 1, else many.

func Width

func Width(s string) int

Width is how many terminal columns s takes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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