barista.run: barista.run/group/collapsing Index | Files

package collapsing

import "barista.run/group/collapsing"

Package collapsing provides a group that supports expanding/collapsing, and a controller to allow programmatic expansion/collapse.

When collapsed (default state), only a button to expand is visible. When expanded, all module outputs are shown, and buttons to collapse.

Index

Package Files

collapsing.go

func DefaultButtons Uses

func DefaultButtons(c Controller) (start, end bar.Output)

DefaultButtons returns the default button outputs: - When expanded, a '>' and '<' on either side. - When collapsed, a single '+'.

type ButtonFunc Uses

type ButtonFunc func(Controller) (start, end bar.Output)

ButtonFunc produces outputs for buttons in a collapsing group.

type Controller Uses

type Controller interface {
    // Expanded returns true if the group is expanded (showing output).
    Expanded() bool
    // Collapse collapses the group and hides all modules.
    Collapse()
    // Expand expands the group and shows all modules.
    Expand()
    // Toggle toggles the visibility of all modules.
    Toggle()
    // ButtonFunc controls the output for the button(s).
    ButtonFunc(ButtonFunc)
}

Controller provides an interface to control a collapsing group.

func Group Uses

func Group(m ...bar.Module) (bar.Module, Controller)

Group returns a new collapsing group, and a linked controller.

Package collapsing imports 8 packages (graph) and is imported by 1 packages. Updated 2018-11-25. Refresh now. Tools for package owners.