Documentation
¶
Overview ¶
Package bonsai grows procedural ASCII bonsai trees in the terminal.
It is a tcell-based port of cbonsai (https://gitlab.com/jallbrit/cbonsai). The public surface is intentionally small: build an Options value and call Run. The package owns the screen lifetime; on return the terminal is restored.
Index ¶
Constants ¶
View Source
const ( PotBig = 1 PotSmall = 2 )
Pot kinds accepted by Options.Pot.
View Source
const ( AlignCenter = int(center) AlignLeft = int(left) AlignRight = int(right) )
Alignment values accepted by Options.Align.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶
type Options struct {
Seed int64 // 0 -> time.Now().UnixNano()
Life int // 0 -> 32, clamped to [1,127]
Multiplier int // 0 -> 5, clamped to [0,20]
Pot int // 0 -> PotBig
Align int // 0 -> AlignCenter
Leaves []string // nil -> []string{"&"}
Message string // optional message box
MsgX, MsgY int // upper-left of message; defaults 4,2
BaseX, BaseY int // overrides for pot position; 0 = auto-center
Print bool // dump tree to stdout and exit
Live bool // animate growth step-by-step
Step time.Duration // delay between live steps; 0 -> 33ms
Infinite bool // keep regrowing until quit
Wait time.Duration // delay between trees in infinite mode; 0 -> 4s
Screensaver bool // implies Live + Infinite, exits on any keypress
}
Options configures a single Run. Zero values pick cbonsai-compatible defaults inside Run, so callers can pass an empty Options{} for "just grow a tree".
Click to show internal directories.
Click to hide internal directories.