Documentation ¶
Index ¶
- Constants
- func EditString(tempPattern string, oldValue string) (string, error)
- func GetEditor() (string, error)
- func GetSize() (w, h int)
- func IsColorEnabled() bool
- func IsInteractive() bool
- func LookEditor() (string, error)
- func PrintTree(w io.Writer, node *TreeNode)
- func TrimToVisualLength(message string, length int) string
- func VisualLength(str string) int
- type BottomPanel
- type ColorCache
- type RawMode
- type TreeBuilder
- type TreeNode
Constants ¶
const Esc = 27
const ResetCode = "\u001b[0m"
const ScrollOff = 4
Minimum number of scrolling terminal lines to display, no matter the requested panel size.
Variables ¶
This section is empty.
Functions ¶
func IsInteractive ¶
func IsInteractive() bool
func TrimToVisualLength ¶
TrimToVisualLength truncates the given message to the given length (taking into account ansi escape sequences) From <https://github.com/wagoodman/bashful>.
func VisualLength ¶
VisualLength determines the length of a string (taking into account ansi control sequences) From <https://github.com/wagoodman/bashful>.
Types ¶
type BottomPanel ¶
type BottomPanel struct {
// contains filtered or unexported fields
}
Zero value is ready to use. Operations on panel affect Stdout. Must call Close() when done, to restore terminal settings.
func (*BottomPanel) Close ¶
func (p *BottomPanel) Close()
func (*BottomPanel) Content ¶
func (p *BottomPanel) Content() string
func (*BottomPanel) Height ¶
func (p *BottomPanel) Height() int
func (*BottomPanel) SetContent ¶
func (p *BottomPanel) SetContent(value string)
Set the content to appear at the bottom of the scrollback buffer. Will be truncated if it is larger than the panel's height.
func (*BottomPanel) SetHeight ¶
func (p *BottomPanel) SetHeight(value int)
Set the panel height. The rendered height may be smaller than the requested height, if the requested height exceeds the terminal height minus ScrollOff.
type ColorCache ¶
type ColorCache struct {
// contains filtered or unexported fields
}
Maps a key to a stable, arbitrary color.
func NewColorCache ¶
func NewColorCache() *ColorCache
func (*ColorCache) Color ¶
func (cache *ColorCache) Color(key string) colorful.Color
type RawMode ¶
type RawMode struct { // Zero value signals stdin. FD uintptr // contains filtered or unexported fields }
func (*RawMode) Suspend ¶
Based on NetHack: <https://nethackwiki.com/wiki/%5EZ#cite_note-1>.
type TreeBuilder ¶
type TreeBuilder struct {
// contains filtered or unexported fields
}
func NewTreeBuilder ¶
func NewTreeBuilder() *TreeBuilder
func (*TreeBuilder) AddNode ¶
func (b *TreeBuilder) AddNode(node *TreeNode)
func (*TreeBuilder) Build ¶
func (b *TreeBuilder) Build() (roots []*TreeNode)
type TreeNode ¶
type TreeNode struct { ID string ParentID string Label string // Left-most column, part of the tree shape. Content string // Second column, aligned after the labels. Suffix string // Right-aligned, third column. HideChildren bool // Fields set by TreeBuilder. Parent *TreeNode ChildIndex int Children []*TreeNode LabelWidth int // Max visual width of own and children's label with padding. }