barista.run: barista.run/outputs Index | Files

package outputs

import "barista.run/outputs"

Package outputs provides helper functions to construct bar.Outputs.

Index

Package Files

group.go outputs.go timed.go timedelta.go

func Error Uses

func Error(e error) *bar.Segment

Error constructs a bar output that indicates an error.

func Errorf Uses

func Errorf(format string, args ...interface{}) *bar.Segment

Errorf constructs a bar output that indicates an error, using the given format string and arguments.

func Pango Uses

func Pango(things ...interface{}) *bar.Segment

Pango constructs a pango bar segment from a list of pango Nodes and strings.

func Text Uses

func Text(text string) *bar.Segment

Text constructs a simple text output from the given string.

func Textf Uses

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

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

type AtTimeDelta Uses

type AtTimeDelta func(time.Duration) bar.Output

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 Uses

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 Uses

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 Uses

type Repeat func(time.Time) bar.Output

Repeat creates a TimedOutput from a function by repeatedly calling it at different times.

func (Repeat) At Uses

func (r Repeat) At(times ...time.Time) bar.TimedOutput

At repeats the output at the specified fixed points in time.

func (Repeat) AtNext Uses

func (r Repeat) AtNext(interval time.Duration) bar.TimedOutput

AtNext repeats the output at multiples of the given duration. e.g. AtNext(time.Minute) will repeat the output at 13:00:00, 13:01:00, and so on, regardless of the first output time.

func (Repeat) Every Uses

func (r Repeat) Every(interval time.Duration) bar.TimedOutput

Every repeats the output at a fixed interval.

type SegmentGroup Uses

type SegmentGroup struct {
    // contains filtered or unexported fields
}

SegmentGroup represents a group of Segments to be displayed together on the bar.

func Group Uses

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 Uses

func (g *SegmentGroup) Align(align bar.TextAlignment) *SegmentGroup

Align sets the text alignment for all segments in the group.

func (*SegmentGroup) Append Uses

func (g *SegmentGroup) Append(output bar.Output) *SegmentGroup

Append adds an additional output to this group.

func (*SegmentGroup) Background Uses

func (g *SegmentGroup) Background(background color.Color) *SegmentGroup

Background sets the background color for all segments in the group.

func (*SegmentGroup) Border Uses

func (g *SegmentGroup) Border(border color.Color) *SegmentGroup

Border sets the border color for all segments in the group.

func (*SegmentGroup) Color Uses

func (g *SegmentGroup) Color(color color.Color) *SegmentGroup

Color sets the color for all segments in the group.

func (*SegmentGroup) Glue Uses

func (g *SegmentGroup) Glue() *SegmentGroup

Glue is a shortcut to remove the inner separators and padding.

func (*SegmentGroup) InnerPadding Uses

func (g *SegmentGroup) InnerPadding(separatorWidth int) *SegmentGroup

InnerPadding sets the padding between segments of this group.

func (*SegmentGroup) InnerSeparators Uses

func (g *SegmentGroup) InnerSeparators(separator bool) *SegmentGroup

InnerSeparators sets the separator visibility between segments of this group.

func (*SegmentGroup) MinWidth Uses

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 Uses

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 Uses

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 Uses

func (g *SegmentGroup) Padding(separatorWidth int) *SegmentGroup

Padding sets the padding of the last segment in the group.

func (*SegmentGroup) Segments Uses

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 Uses

func (g *SegmentGroup) Separator(separator bool) *SegmentGroup

Separator sets the separator visibility of the last segment in the group.

func (*SegmentGroup) Urgent Uses

func (g *SegmentGroup) Urgent(urgent bool) *SegmentGroup

Urgent sets the urgency flag for all segments in the group.

Package outputs imports 9 packages (graph) and is imported by 30 packages. Updated 2019-02-18. Refresh now. Tools for package owners.