tmuxfmt

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2023 License: GPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package tmuxfmt constructs tmux FORMATS compatible strings.

See http://man.openbsd.org/OpenBSD-current/man1/tmux.1#FORMATS for a specification of the format of these strings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(e Expr) string

Render renders the provided tmux expressions separated by the given delimiter in a format compatible with tmux's FORMATS section.

Types

type Binary

type Binary struct {
	Op       BinaryOp
	LHS, RHS Expr
}

Binary is a binary expression.

#{op:lhs,rhs}

type BinaryOp

type BinaryOp int

BinaryOp is a binary operation.

const (
	Equals            BinaryOp = iota // ==
	NotEquals                         // !=
	LessThan                          // <
	GreaterThan                       // >
	LessThanEquals                    // <=
	GreaterThanEquals                 // >=
)

Supported binary operations.

func (BinaryOp) String

func (op BinaryOp) String() string

type Capturer

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

Capturer captures the output of tmuxfmt expressions into Go values.

func (*Capturer) BoolVar

func (c *Capturer) BoolVar(ptr *bool, e Expr)

BoolVar specifies that the output of the provided expression should be parsed as a boolean and fill this boolean pointer.

func (*Capturer) IntVar

func (c *Capturer) IntVar(ptr *int, e Expr)

IntVar specifies that the output of the provided expression should be parsed as an integer and fill this integer pointer.

func (*Capturer) Prepare

func (c *Capturer) Prepare() (msg string, capure func([]byte) error)

Prepare prepares the specified expressions into a tmuxfmt message. The returned capture function will parse the resultant text and fill the previously recorded pointers.

func (*Capturer) StringVar

func (c *Capturer) StringVar(ptr *string, e Expr)

StringVar specifies that the output of the provided expression should fill this string pointer.

func (*Capturer) Var

func (c *Capturer) Var(v Value, e Expr)

Var records that the output of the given tmuxfmt expression should be loaded into the specified value.

type Expr

type Expr interface {
	// contains filtered or unexported methods
}

Expr is the base interface for expressions accepted by the tmux message format.

type Int

type Int int

Int is an integer literal in an expression.

42

type String

type String string // must not contain tabs

String is a string literal in an expression.

value

type Ternary

type Ternary struct {
	Cond Expr
	Then Expr
	Else Expr
}

Ternary is a conditional operator that evaluates the first expression and returns either the second or the third expression based on whether it's true.

#{?cond,then,else}

type Value

type Value interface {
	Set(string) error
}

Value receives a value from the tmux output as a string and parses it.

type Var

type Var string

Var is a reference to a variable.

#{name}

Jump to

Keyboard shortcuts

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