keys

package
v0.13.3 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetDefaultBind

func SetDefaultBind(kb **KeyBind, defaultKb KeyBind)

func ValidateBinds

func ValidateBinds(kbs ...[]KeyBind) error

Types

type Key

type Key struct {
	Code   string `validate:"required"     yaml:"code"`
	Alias  string `yaml:"alias,omitempty"`
	Hidden bool   `yaml:"hidden,omitempty"`
}

func New

func New(code string, opts ...KeyOpt) Key

func (Key) String

func (k Key) String() string

type KeyBind

type KeyBind struct {
	Description string
	Keys        []Key
}

func NewBind

func NewBind(description string, keys ...Key) KeyBind

func (*KeyBind) AddKey

func (kb *KeyBind) AddKey(key Key)

func (*KeyBind) Match

func (kb *KeyBind) Match(key string) bool

func (*KeyBind) String

func (kb *KeyBind) String() string

func (*KeyBind) StringRow

func (kb *KeyBind) StringRow(keyWidth, descWidth int) string

KeyWidth should generally be the maximum width of any individual keybind string in the column.

type KeyBindRenderer

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

func (*KeyBindRenderer) AddColumn

func (kbr *KeyBindRenderer) AddColumn(kbs ...KeyBind)

func (*KeyBindRenderer) Render

func (kbr *KeyBindRenderer) Render(width int) string

type KeyOpt

type KeyOpt func(k *Key)

func Hidden

func Hidden() KeyOpt

func WithAlias

func WithAlias(alias string) KeyOpt

Jump to

Keyboard shortcuts

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