utils

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Keys = KeyMap{
	FocusPrev: key.NewBinding(
		key.WithKeys("k", "up"),
		key.WithHelp("k", "move up"),
	),
	FocusNext: key.NewBinding(
		key.WithKeys("j", "down"),
		key.WithHelp("j", "move down"),
	),
	PreviewPageUp: key.NewBinding(
		key.WithKeys("ctrl+u"),
		key.WithHelp("ctrl+u", "page up"),
	),
	PreviewPageDown: key.NewBinding(
		key.WithKeys("ctrl+d"),
		key.WithHelp("ctrl+d", "page down"),
	),
	ToggleReadme: key.NewBinding(
		key.WithKeys("r"),
		key.WithHelp("r", "toggle readme"),
	),
	OpenGithub: key.NewBinding(
		key.WithKeys("o"),
		key.WithHelp("o", "open in github"),
	),
	StarRepo: key.NewBinding(
		key.WithKeys("s"),
		key.WithHelp("s", "star repo"),
	),
	StarGhEco: key.NewBinding(
		key.WithKeys("!"),
		key.WithHelp("!", "star gh-eco"),
	),
	Quit: key.NewBinding(
		key.WithKeys("esc", "ctrl+c"),
		key.WithHelp("esc", "quit"),
	),
	Search: key.NewBinding(
		key.WithKeys("enter"),
		key.WithHelp("enter", "search"),
	),
	FocusInput: key.NewBinding(
		key.WithKeys("/"),
		key.WithHelp("/", "focus input"),
	),
}

Functions

func BrowserOpen

func BrowserOpen(url string)

func GetNewLines

func GetNewLines(n int) string

func MapGetUserQueryToDisplayUser

func MapGetUserQueryToDisplayUser(query queries.GetUserQuery) models.User

func MaxInt

func MaxInt(a, b int) int

func TruncateText

func TruncateText(str string, max int) string

Types

type KeyMap

type KeyMap struct {
	FocusNext       key.Binding
	FocusPrev       key.Binding
	PreviewPageDown key.Binding
	PreviewPageUp   key.Binding
	ToggleReadme    key.Binding
	OpenGithub      key.Binding
	StarRepo        key.Binding
	StarGhEco       key.Binding
	FocusInput      key.Binding
	Search          key.Binding
	Quit            key.Binding
}

Jump to

Keyboard shortcuts

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