/*
* Copyright (C) 2025 Jonni Liljamo <jonni@liljamo.com>
*
* This file is licensed under GPL-3.0-only, see NOTICE and LICENSE for
* more information.
*/
package confirm
import "github.com/charmbracelet/bubbles/key"
// KeyMap defines key bindings for the output viewport.
type KeyMap struct {
Submit key.Binding
Back key.Binding
}
// NewKeyMap returns a new KeyMap.
func NewKeyMap() *KeyMap {
return &KeyMap{
Submit: key.NewBinding(
key.WithKeys("enter"),
key.WithHelp("enter", "submit"),
),
Back: key.NewBinding(
key.WithKeys("q"),
key.WithHelp("q", "back"),
),
}
}
// ShortHelp returns keybindings to be shown in the mini help view. It's part
// of the key.Map interface.
func (k KeyMap) ShortHelp() []key.Binding {
return []key.Binding{k.Submit, k.Back}
}
// FullHelp returns keybindings for the expanded help view. It's part of the
// key.Map interface.
func (k KeyMap) FullHelp() [][]key.Binding {
return [][]key.Binding{
{k.Submit, k.Back},
}
}