utils

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Keys = KeyMap{
	Up: key.NewBinding(
		key.WithKeys("up", "k"),
		key.WithHelp("↑/k", "move up"),
	),
	Down: key.NewBinding(
		key.WithKeys("down", "j"),
		key.WithHelp("↓/j", "move down"),
	),
	NextTab: key.NewBinding(
		key.WithKeys("tab"),
		key.WithHelp("tab", "next tab"),
	),
	PrevTab: key.NewBinding(
		key.WithKeys("shift+tab"),
		key.WithHelp("shift+tab", "previous tab"),
	),
	NextCol: key.NewBinding(
		key.WithKeys("right", "l"),
		key.WithHelp("/l", "next col"),
	),
	PrevCol: key.NewBinding(
		key.WithKeys("left", "h"),
		key.WithHelp("/h", "previous col"),
	),
	StartSearch: key.NewBinding(
		key.WithKeys("/"),
		key.WithHelp("/", "search"),
	),
	EndSearch: key.NewBinding(
		key.WithKeys("esc", "enter"),
	),
	Inspect: key.NewBinding(
		key.WithKeys("enter"),
		key.WithHelp("enter", "inspect"),
	),
	Services: key.NewBinding(
		key.WithKeys("s"),
		key.WithHelp("s", "services"),
	),
	PrevPage: key.NewBinding(
		key.WithKeys("backspace"),
		key.WithHelp("backspace", "prev page"),
	),
	FirstLine: key.NewBinding(
		key.WithKeys("g", "home"),
		key.WithHelp("g/home", "first item"),
	),
	LastLine: key.NewBinding(
		key.WithKeys("G", "end"),
		key.WithHelp("G/end", "last item"),
	),
	TogglePreview: key.NewBinding(
		key.WithKeys("p"),
		key.WithHelp("p", "open in Preview"),
	),
	Refresh: key.NewBinding(
		key.WithKeys("r"),
		key.WithHelp("r", "refresh"),
	),
	Help: key.NewBinding(
		key.WithKeys("?"),
		key.WithHelp("?", "toggle help"),
	),
	Quit: key.NewBinding(
		key.WithKeys("q", "ctrl+c"),
		key.WithHelp("q", "quit"),
	),
}

Functions

func BoolPtr

func BoolPtr(b bool) *bool

func BytesToMB

func BytesToMB(f float64) float64

func Compose2

func Compose2[A0 any, T1 any, T2 any](fn0 func(A0) T1, fn1 func(T1) T2) func(A0) T2

func Float64Ptr

func Float64Ptr(f float64) *float64

func IntPtr

func IntPtr(i int) *int

func Max

func Max(a, b int) int

func Min

func Min(a, b int) int

func StringPtr

func StringPtr(s string) *string

func UseStr

func UseStr(s *string) string

Types

type KeyMap

type KeyMap struct {
	Up            key.Binding
	Down          key.Binding
	FirstLine     key.Binding
	LastLine      key.Binding
	TogglePreview key.Binding
	Refresh       key.Binding
	NextTab       key.Binding
	PrevTab       key.Binding
	NextCol       key.Binding
	PrevCol       key.Binding
	StartSearch   key.Binding
	EndSearch     key.Binding
	Inspect       key.Binding
	Services      key.Binding
	PrevPage      key.Binding
	Help          key.Binding
	Quit          key.Binding
}

func (KeyMap) FullHelp

func (k KeyMap) FullHelp() [][]key.Binding

func (KeyMap) ShortHelp

func (k KeyMap) ShortHelp() []key.Binding

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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