DEVELOPMENT ENVIRONMENT

~liljamo/tamma

ref: e760917e8531f5438ae184ec0c1599f5a3785d1b tamma/types/keymaps.go -rw-r--r-- 994 bytes
e760917eJonni Liljamo feat: enable help, add bindings there 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
 * Copyright (C) 2024 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"
)

// HostListKeyMap defines key bindings for the host list.
type HostListKeyMap struct {
	Quit key.Binding
}

// NewHostListKeyMap returns a new HostListKeyMap.
func NewHostListKeyMap() *HostListKeyMap {
	return &HostListKeyMap{
		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
}

// 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"),
		),
	}
}