Back to / group

Package group

v0.0.0 (1744759)
Latest Go to latest
Published: Aug 7, 2020 | License: Apache-2.0 | Module:


Package group provides a module that groups existing modules, and uses a provided Grouper to selectively display output from these modules.


Package Files

func New

func New(g Grouper, m bar.Module

New constructs a new group using the given Grouper and modules.

func Simple

func Simple(mods bar.Module

Simple groups modules together with no extra controls. This is useful if you need multiple modules where only one module is accepted.

type Grouper

type Grouper interface {
	// Visible returns true if the module at a given index is visible.
	Visible(index int) bool
	// Button returns the bar output for the buttons on either end.
	Buttons() (start, end bar.Output)

Grouper controls how a group displays the output from it's modules.

type Signaller

type Signaller interface {
	// Signal returns a channel that signals any updates from the grouper.
	// Signals to this channel will cause the group to recalculate output.
	Signal() <-chan struct{}

Signaller adds an additional source of updates to the group, based on changes that do not cause any of the modules to refresh.

type UpdateListener

type UpdateListener interface {
	// Updated is called with the index of the module that just updated
	// its output, before the calls to Button(...) or Visble(...)
	Updated(index int)

UpdateListener receives an update whenever a module in the group updates its output.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier