barista.run: barista.run/modules/shell Index | Files

package shell

import "barista.run/modules/shell"

Package shell provides modules to display the output of shell commands. It supports both long-running commands, where the output is the last line, e.g. dmesg or tail -f /var/log/some.log, and repeatedly running commands, e.g. whoami, date +%s.

Index

Package Files

shell.go tail.go

type Module Uses

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

Module represents a shell module that updates on a timer or on demand.

func New Uses

func New(cmd string, args ...string) *Module

New constructs a new shell module.

func (*Module) Every Uses

func (m *Module) Every(interval time.Duration) *Module

Every sets the refresh interval for the module. The command will be executed repeatedly at the given interval, and the output updated. A zero interval stops automatic repeats (but Refresh will still work).

func (*Module) Output Uses

func (m *Module) Output(format func(string) bar.Output) *Module

Output sets the output format. The format func will be passed the entire trimmed output from the command once it's done executing. To process output by lines, see Tail().

func (*Module) Refresh Uses

func (m *Module) Refresh()

Refresh executes the command and updates the output.

func (*Module) Stream Uses

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

Stream starts the module.

type TailModule Uses

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

TailModule represents a bar.Module that displays the last line of output from a shell command in the bar.

func Tail Uses

func Tail(cmd string, args ...string) *TailModule

Tail constructs a module that displays the last line of output from a long running command.

func (*TailModule) Output Uses

func (m *TailModule) Output(format func(string) bar.Output) *TailModule

Output sets the output format for each line of output.

func (*TailModule) Stream Uses

func (m *TailModule) Stream(s bar.Sink)

Stream starts the module.

Package shell imports 10 packages (graph). Updated 2018-11-25. Refresh now. Tools for package owners.