Documentation ¶
Overview ¶
Package outputs provides helper functions to construct bar.Outputs.
Index ¶
- func Error(e error) *bar.Segment
- func Errorf(format string, args ...interface{}) *bar.Segment
- func Pango(things ...interface{}) *bar.Segment
- func Text(text string) *bar.Segment
- func Textf(format string, args ...interface{}) *bar.Segment
- type AtTimeDelta
- type Repeat
- type SegmentGroup
- func (g *SegmentGroup) Align(align bar.TextAlignment) *SegmentGroup
- func (g *SegmentGroup) Append(output bar.Output) *SegmentGroup
- func (g *SegmentGroup) Background(background color.Color) *SegmentGroup
- func (g *SegmentGroup) Border(border color.Color) *SegmentGroup
- func (g *SegmentGroup) Color(color color.Color) *SegmentGroup
- func (g *SegmentGroup) Glue() *SegmentGroup
- func (g *SegmentGroup) InnerPadding(separatorWidth int) *SegmentGroup
- func (g *SegmentGroup) InnerSeparators(separator bool) *SegmentGroup
- func (g *SegmentGroup) MinWidth(minWidth int) *SegmentGroup
- func (g *SegmentGroup) NextRefresh() time.Time
- func (g *SegmentGroup) OnClick(f func(bar.Event)) *SegmentGroup
- func (g *SegmentGroup) Padding(separatorWidth int) *SegmentGroup
- func (g *SegmentGroup) Segments() []*bar.Segment
- func (g *SegmentGroup) Separator(separator bool) *SegmentGroup
- func (g *SegmentGroup) Urgent(urgent bool) *SegmentGroup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Error ¶
Error constructs a bar output that indicates an error.
func Errorf ¶
Errorf constructs a bar output that indicates an error, using the given format string and arguments.
func Pango ¶
Pango constructs a pango bar segment from a list of pango Nodes and strings.
func Text ¶
Text constructs a simple text output from the given string.
Types ¶
type AtTimeDelta ¶
AtTimeDelta creates a TimedOutput from a function by repeatedly calling it at different times, using a fixed point in time as a reference point.
func (AtTimeDelta) From ¶
func (a AtTimeDelta) From(time time.Time) bar.TimedOutput
From sets the reference point and creates a timed output that repeats the given function. The repeat rate is: - delta < 1 minute: every second - delta < 1 hour: every minute - otherwise: every hour This is useful if the output displays a single time unit (e.g. 3m, or 8h).
func (AtTimeDelta) FromFine ¶
func (a AtTimeDelta) FromFine(time time.Time) bar.TimedOutput
FromFine is From with more rapid updates: - delta < 1 hour: every second - delta < 24 hours: every minute - otherwise: every hour This is useful if the output displays two time units (e.g. 5h3m, or 2d7h).
type Repeat ¶
Repeat creates a TimedOutput from a function by repeatedly calling it at different times.
func (Repeat) At ¶
func (r Repeat) At(times ...time.Time) bar.TimedOutput
At repeats the output at the specified fixed points in time.
type SegmentGroup ¶
type SegmentGroup struct {
// contains filtered or unexported fields
}
SegmentGroup represents a group of Segments to be displayed together on the bar.
func Group ¶
func Group(outputs ...bar.Output) *SegmentGroup
Group concatenates several outputs into a single SegmentGroup, to facilitate easier manipulation of output properties. For example, setting a colour or urgency for all segments together.
func (*SegmentGroup) Align ¶
func (g *SegmentGroup) Align(align bar.TextAlignment) *SegmentGroup
Align sets the text alignment for all segments in the group.
func (*SegmentGroup) Append ¶
func (g *SegmentGroup) Append(output bar.Output) *SegmentGroup
Append adds an additional output to this group.
func (*SegmentGroup) Background ¶
func (g *SegmentGroup) Background(background color.Color) *SegmentGroup
Background sets the background color for all segments in the group.
func (*SegmentGroup) Border ¶
func (g *SegmentGroup) Border(border color.Color) *SegmentGroup
Border sets the border color for all segments in the group.
func (*SegmentGroup) Color ¶
func (g *SegmentGroup) Color(color color.Color) *SegmentGroup
Color sets the color for all segments in the group.
func (*SegmentGroup) Glue ¶
func (g *SegmentGroup) Glue() *SegmentGroup
Glue is a shortcut to remove the inner separators and padding.
func (*SegmentGroup) InnerPadding ¶
func (g *SegmentGroup) InnerPadding(separatorWidth int) *SegmentGroup
InnerPadding sets the padding between segments of this group.
func (*SegmentGroup) InnerSeparators ¶
func (g *SegmentGroup) InnerSeparators(separator bool) *SegmentGroup
InnerSeparators sets the separator visibility between segments of this group.
func (*SegmentGroup) MinWidth ¶
func (g *SegmentGroup) MinWidth(minWidth int) *SegmentGroup
MinWidth sets the minimum width for the output, by (mostly) equally distributing the given minWidth amongst all segments in the group.
func (*SegmentGroup) NextRefresh ¶
func (g *SegmentGroup) NextRefresh() time.Time
NextRefresh handles the case of one or more TimedOutputs being added to the group. If any timed outputs exist, NextRefresh will return the earliest next refresh time of any of them.
func (*SegmentGroup) OnClick ¶
func (g *SegmentGroup) OnClick(f func(bar.Event)) *SegmentGroup
OnClick sets the default click handler for the group. Any segments that don't already have a click handler will delegate to this one.
func (*SegmentGroup) Padding ¶
func (g *SegmentGroup) Padding(separatorWidth int) *SegmentGroup
Padding sets the padding of the last segment in the group.
func (*SegmentGroup) Segments ¶
func (g *SegmentGroup) Segments() []*bar.Segment
Segments implements bar.Output for SegmentGroup. This method is responsible for computing all attributes so that all segments, even those added after attributes were set on the group correctly reflect those attributes in the final output.
func (*SegmentGroup) Separator ¶
func (g *SegmentGroup) Separator(separator bool) *SegmentGroup
Separator sets the separator visibility of the last segment in the group.
func (*SegmentGroup) Urgent ¶
func (g *SegmentGroup) Urgent(urgent bool) *SegmentGroup
Urgent sets the urgency flag for all segments in the group.