Files
Transmute/cli/internal/tui/keys.go
T
noah 04a1f33cb1 feat: add CLI with TUI, self-update, install script, and terminal section on landing page
- Full-screen Bubble Tea TUI with cream background fill using PadLine/FillBlankLines
- Self-update command (--update) pulling from GitHub releases
- install.sh for curl one-liner installation
- Terminal Lovers section on web landing page with install command and CLI features
- All 7 format categories, glob/directory batch support, auto-download ffmpeg
2026-03-09 22:53:10 +01:00

79 lines
1.7 KiB
Go

package tui
import "github.com/charmbracelet/bubbles/key"
// KeyMap defines key bindings for the TUI.
type KeyMap struct {
Up key.Binding
Down key.Binding
Left key.Binding
Right key.Binding
Enter key.Binding
Space key.Binding
Tab key.Binding
Delete key.Binding
SelectAll key.Binding
Convert key.Binding
Quit key.Binding
Help key.Binding
Back key.Binding
}
// DefaultKeyMap returns the default key bindings.
func DefaultKeyMap() KeyMap {
return KeyMap{
Up: key.NewBinding(
key.WithKeys("up", "k"),
key.WithHelp("↑/k", "up"),
),
Down: key.NewBinding(
key.WithKeys("down", "j"),
key.WithHelp("↓/j", "down"),
),
Left: key.NewBinding(
key.WithKeys("left", "h"),
key.WithHelp("←/h", "prev format"),
),
Right: key.NewBinding(
key.WithKeys("right", "l"),
key.WithHelp("→/l", "next format"),
),
Enter: key.NewBinding(
key.WithKeys("enter"),
key.WithHelp("enter", "confirm"),
),
Space: key.NewBinding(
key.WithKeys(" "),
key.WithHelp("space", "toggle select"),
),
Tab: key.NewBinding(
key.WithKeys("tab"),
key.WithHelp("tab", "cycle format"),
),
Delete: key.NewBinding(
key.WithKeys("d", "delete", "backspace"),
key.WithHelp("d", "remove file"),
),
SelectAll: key.NewBinding(
key.WithKeys("a"),
key.WithHelp("a", "select all"),
),
Convert: key.NewBinding(
key.WithKeys("c"),
key.WithHelp("c", "convert"),
),
Quit: key.NewBinding(
key.WithKeys("q", "ctrl+c"),
key.WithHelp("q", "quit"),
),
Help: key.NewBinding(
key.WithKeys("?"),
key.WithHelp("?", "help"),
),
Back: key.NewBinding(
key.WithKeys("esc"),
key.WithHelp("esc", "back"),
),
}
}