tui

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MARGIN                   = 2
	PADDING                  = 1
	MAX_WIDTH                = 80
	PRIMARY_COLOR            = "#B8BABA"
	SECONDARY_COLOR          = "#626262"
	DARK_COLOR               = "#232323"
	ELEMENT_COLOR            = "#EE9F40"
	SECONDARY_ELEMENT_COLOR  = "#e87d3e"
	ERROR_COLOR              = "#CC0000"
	WARNING_COLOR            = "#EE9F5C"
	CHECK_COLOR              = "#34B233"
	SHUTDOWN_PERIOD          = 500 * time.Millisecond
	TEMP_UI_MESSAGE_DURATION = 2 * time.Second
)

Variables

View Source
var BaseStyle = lipgloss.NewStyle()
View Source
var BoldText = BaseStyle.Copy().Bold(true).Render
View Source
var CompressingSpinner = spinner.Spinner{
	Frames: []string{"┉┉┉", "┅┅┅", "┄┄┄", "┉ ┉", "┅ ┅", "┄ ┄", " ┉ ", " ┉ ", " ┅ ", " ┅ ", " ┄ "},
	FPS:    time.Second / 3,
}
View Source
var CopyKeyActiveHelpText = SuccessText("✓") + HelpStyle(" password → clipboard")
View Source
var CopyKeyHelpText = BaseStyle.Render("password → clipboard")
View Source
var ErrorText = BaseStyle.Copy().Foreground(lipgloss.Color(ERROR_COLOR)).Render
View Source
var HelpStyle = BaseStyle.Copy().Foreground(lipgloss.Color(SECONDARY_COLOR)).Render
View Source
var InfoStyle = BaseStyle.Copy().Foreground(lipgloss.Color(PRIMARY_COLOR)).Render
View Source
var ItalicText = BaseStyle.Copy().Italic(true).Render
View Source
var Keys = KeyMap{
	Quit: key.NewBinding(
		key.WithKeys("q", "esc", "ctrl+c"),
		key.WithHelp("(q)", "quit"),
	),
	CopyPassword: key.NewBinding(
		key.WithKeys("c"),
		key.WithHelp("(c)", CopyKeyHelpText),
		key.WithDisabled(),
	),
	FileListUp: key.NewBinding(
		key.WithKeys("up", "k"),
		key.WithHelp("(↑/k)", "file summary up"),
		key.WithDisabled(),
	),
	FileListDown: key.NewBinding(
		key.WithKeys("down", "j"),
		key.WithHelp("(↓/j)", "file summary down"),
		key.WithDisabled(),
	),
	OverwritePromptYes: key.NewBinding(
		key.WithKeys("y", "Y"),
		key.WithHelp("(Y/y)", "accept overwrite"),
		key.WithDisabled(),
	),
	OverwritePromptNo: key.NewBinding(
		key.WithKeys("n", "N"),
		key.WithHelp("(N/n)", "deny overwrite"),
		key.WithDisabled(),
	),
	OverwritePromptConfirm: key.NewBinding(
		key.WithKeys("enter"),
		key.WithHelp("(⏎ )", "confirm choice"),
		key.WithDisabled(),
	),
}
View Source
var PadText = strings.Repeat(" ", MARGIN)
View Source
var ReceivingSpinner = spinner.Spinner{
	Frames: []string{"┄┄┄", "┄┄⇠", "┄⇠┄", "⇠┄┄"},
	FPS:    time.Second / 2,
}
View Source
var SuccessText = BaseStyle.Copy().Foreground(lipgloss.Color(CHECK_COLOR)).Render
View Source
var TransferSpinner = spinner.Spinner{
	Frames: []string{"⇢┄┄", "┄⇢┄", "┄┄⇢", "┄┄┄"},
	FPS:    time.Millisecond * 400,
}
View Source
var WaitingSpinner = spinner.Spinner{
	Frames: []string{"⠋ ", "⠙ ", "⠹ ", "⠸ ", "⠼ ", "⠴ ", "⠦ ", "⠧ ", "⠇ ", "⠏ "},
	FPS:    time.Second / 12,
}
View Source
var WarningText = BaseStyle.Copy().Foreground(lipgloss.Color(WARNING_COLOR)).Render

Functions

func ByteCountSI

func ByteCountSI(b int64) string

Credits to (legendary Mr. Nilsson): https://yourbasic.org/golang/formatting-byte-size-to-human-readable-format/

func ErrorCmd

func ErrorCmd(err error) tea.Cmd

func LogSeparator

func LogSeparator(width int) string

func NewProgressBar

func NewProgressBar() progress.Model

func QuitCmd

func QuitCmd() tea.Cmd

func TaskCmd

func TaskCmd(task string, cmd tea.Cmd) tea.Cmd

func TopLevelFilesText

func TopLevelFilesText(fileNames []string) string

func VersionCmd

func VersionCmd(ctx context.Context, rendezvousAddr string) tea.Cmd

Types

type ErrorMsg

type ErrorMsg error

type KeyMap

type KeyMap struct {
	Quit                   key.Binding
	CopyPassword           key.Binding
	FileListUp             key.Binding
	FileListDown           key.Binding
	OverwritePromptYes     key.Binding
	OverwritePromptNo      key.Binding
	OverwritePromptConfirm key.Binding
}

func (KeyMap) FullHelp

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

func (KeyMap) ShortHelp

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

type ProgressMsg

type ProgressMsg int

type SecureMsg

type SecureMsg struct {
	Conn conn.Transfer
}

type TransferStateMessage

type TransferStateMessage struct {
	State transfer.MsgType
}

type TransferTypeMsg

type TransferTypeMsg struct {
	Type transfer.Type
}

type VersionMsg

type VersionMsg struct {
	ServerVersion semver.Version
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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