/*
* 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 types
import (
"github.com/charmbracelet/bubbles/key"
)
// TargetListKeyMap defines key bindings for the target list.
type TargetListKeyMap struct {
Quit key.Binding
}
// NewTargetListKeyMap returns a new TargetListKeyMap.
func NewTargetListKeyMap() *TargetListKeyMap {
return &TargetListKeyMap{
Quit: key.NewBinding(
key.WithKeys("q"),
key.WithHelp("q", "quit"),
),
}
}
// ActionListKeyMap defines key bindings for the action list.
type ActionListKeyMap struct {
Back key.Binding
CopyCommand key.Binding
ViewOutput key.Binding
}
// NewActionListKeyMap returns a new ActionListKeyMap.
func NewActionListKeyMap() *ActionListKeyMap {
return &ActionListKeyMap{
Back: key.NewBinding(
key.WithKeys("q"),
key.WithHelp("q", "back"),
),
CopyCommand: key.NewBinding(
key.WithKeys("c"),
key.WithHelp("c", "copy cmd"),
),
ViewOutput: key.NewBinding(
key.WithKeys("o"),
key.WithHelp("o", "view output"),
),
}
}
// OutputViewportKeyMap defines key bindings for the output viewport.
type OutputViewportKeyMap struct {
Back key.Binding
}
// NewOutputViewportKeyMap returns a new OutputViewportKeyMap.
func NewOutputViewportKeyMap() *OutputViewportKeyMap {
return &OutputViewportKeyMap{
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 OutputViewportKeyMap) ShortHelp() []key.Binding {
return []key.Binding{k.Back}
}
// FullHelp returns keybindings for the expanded help view. It's part of the
// key.Map interface.
func (k OutputViewportKeyMap) FullHelp() [][]key.Binding {
return [][]key.Binding{
{k.Back},
}
}