outputs

package
v0.0.0-...-1143ee3 Latest Latest
Warning

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

Go to latest
Published: May 23, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package outputs provides helper functions to construct bar.Outputs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Empty

func Empty() bar.Output

Empty constructs an empty output, which will hide a module from the bar.

func Error

func Error(e error) bar.Output

Error constructs a bar output that indicates an error.

func Pango

func Pango(things ...interface{}) bar.Output

Pango constructs a bar output from a list of things.

func PangoUnsafe

func PangoUnsafe(markup string) bar.Output

PangoUnsafe constructs a bar output from existing pango markup. This function does not perform any escaping.

func Text

func Text(text string) bar.Output

Text constructs a simple text output from the given string.

func Textf

func Textf(format string, args ...interface{}) bar.Output

Textf constructs simple text output from a format string and arguments.

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.

func Multi

func Multi() Composite

Multi creates an empty composite output, to which named segments can be added.

type TemplateFunc

type TemplateFunc func(interface{}) bar.Output

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.

Jump to

Keyboard shortcuts

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