ui

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Term   = termenv.EnvColorProfile()
	Subtle = MakeFgStyle("241")
	Red    = MakeFgStyle("196")
	Green  = MakeFgStyle("46")
	Yellow = MakeFgStyle("226")
)

General stuff for styling the view

Functions

func Checkbox

func Checkbox(label string, checked bool) string

Checkbox represent [ ] and [x] items in the view.

func ColorFg

func ColorFg(val, color string) string

ColorFg a string's foreground with the given value.

func ErrorMessage

func ErrorMessage(err error) string

ErrorMessage returns an error message.

func GoodByeMessage

func GoodByeMessage() string

GoodByeMessage returns a goodbye message.

func MakeFgStyle

func MakeFgStyle(color string) func(string) string

MakeFgStyle returns a function that will colorize the foreground of a given.

func Split

func Split(s string) []string

Split splits a string into multiple lines. Each line has a maximum length of 80 characters.

func ToggleWidget

func ToggleWidget(label string, now, enabled bool) string

ToggleWidget represents a toggle.

Types

type Choice

type Choice struct {
	// Choice is the currently selected menu item.
	Choice int
	// Max is the maximum choice number.
	Max int
	// Min is the minimum choice number.
	Min int
}

Choice represents a choice.

func NewChoice

func NewChoice(min, max int) *Choice

NewChoice returns a new choice.

func (*Choice) Decrement

func (c *Choice) Decrement()

Decrement decrements the choice. If the choice is less than the minimum, the choice is set to the maximum.

func (*Choice) Increment

func (c *Choice) Increment()

Increment increments the choice. If the choice is greater than the maximum, the choice is set to the minimum.

type ErrMsg

type ErrMsg error

ErrMsg is an error message.

type Toggle

type Toggle struct {
	Enabled bool
}

Toggle represents a toggle.

func NewToggle

func NewToggle() *Toggle

NewToggle returns a new toggle.

func (*Toggle) Toggle

func (t *Toggle) Toggle()

Toggle toggles the toggle.

type ToggleSets

type ToggleSets []*Toggle

ToggleSets represents a set of toggles.

func NewToggleSets

func NewToggleSets(n int) ToggleSets

NewToggleSets returns a new toggle sets.

type Window

type Window struct {
	// Width is the window width.
	Width int
	// Height is the window height.
	Height int
}

Window represents the window size.

func NewWindow

func NewWindow(width, height int) *Window

NewWindow returns a new window.

Directories

Path Synopsis
Package s3hub is the text-based user interface for s3hub command.
Package s3hub is the text-based user interface for s3hub command.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL