Documentation ¶
Overview ¶
Package outputs provides helper functions to construct bar.Outputs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PangoUnsafe ¶
PangoUnsafe constructs a bar output from existing pango markup. This function does not perform any escaping.
Types ¶
type Composite ¶
type Composite interface { // Add appends a named output segment to the composite bar output // and returns it for chaining. Add(string, bar.Output) Composite // AddPango appends a named pango output segment to the composite // bar output and returns it for chaining. AddPango(instance string, things ...interface{}) Composite // AddTextf appends a named text output segment with formatting // to the composite bar output and returns it for chaining. AddTextf(instance string, format string, args ...interface{}) Composite // AddText appends a named text output segment to the composite // bar output and returns it for chaining. AddText(instance string, text string) Composite // KeepSeparators sets whether inter-segment separators are removed. // By default, inter-segment separators are removed when Build is called, // but that behaviour can be overridden by calling KeepSeparators(true). KeepSeparators(bool) Composite // Build returns the built bar.Output with each segment's instance set // to the appropriate value. Build() bar.Output }
Composite represents a "composite" bar output that collects compositeple outputs and assigns each output a different "instance" name so that click handlers can know what part of the output was clicked.
type TemplateFunc ¶
TemplateFunc is a function that takes in a single argument constructs a bar output from it.
func PangoTemplate ¶
func PangoTemplate(tpl string) TemplateFunc
PangoTemplate creates a TemplateFunc from the given pango template. It uses go's html/template to escape input properly.
func TextTemplate ¶
func TextTemplate(tpl string) TemplateFunc
TextTemplate creates a TemplateFunc from the given text template.