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

package core

import "barista.run/core"

Package core provides some of the basic barista functionality, enabling more complex constructs without duplicating code or logic.

Index

Package Files

module.go moduleset.go

type Module Uses

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

Module represents a bar.Module wrapped with core barista functionality. It is used as a building block for the main bar, modules that manipulate other modules (group, reformat), and for writing tests. It handles restarting the wrapped module on a left/right/middle click, as well as providing an option to "replay" the last output from the module. It also provides timed output functionality.

func NewModule Uses

func NewModule(original bar.Module) *Module

NewModule wraps an existing bar.Module with core barista functionality, such as restarts and the ability to replay the last output.

func (*Module) Replay Uses

func (m *Module) Replay()

Replay sends the last output from the wrapped module to the sink.

func (*Module) Stream Uses

func (m *Module) Stream(sink bar.Sink)

Stream runs the module with the given sink, automatically handling terminations/restarts of the wrapped module.

type ModuleSet Uses

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

ModuleSet is a group of modules. It provides a channel for identifying module updates, and methods to get the last output of the set or a specific module.

func NewModuleSet Uses

func NewModuleSet(modules []bar.Module) *ModuleSet

NewModuleSet creates a ModuleSet with the given modules.

func (*ModuleSet) LastOutput Uses

func (m *ModuleSet) LastOutput(idx int) bar.Segments

LastOutput returns the last output from the module at a specific position. If the module has not yet updated, an empty output will be used.

func (*ModuleSet) LastOutputs Uses

func (m *ModuleSet) LastOutputs() []bar.Segments

LastOutputs returns the last output from all modules in order. The returned slice will have exactly Len() elements, and if a module has not yet updated an empty output will be placed in its position.

func (*ModuleSet) Len Uses

func (m *ModuleSet) Len() int

Len returns the number of modules in this ModuleSet.

func (*ModuleSet) Stream Uses

func (m *ModuleSet) Stream() <-chan int

Stream starts streaming all modules and returns a channel that receives the index of the module any time one updates with new output.

Package core imports 7 packages (graph) and is imported by 6 packages. Updated 2018-11-25. Refresh now. Tools for package owners.