mirror of
https://github.com/anotherhadi/spilltea.git
synced 2026-05-20 09:42:34 +02:00
a6bd5c1071
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
42 lines
1.2 KiB
Go
42 lines
1.2 KiB
Go
package keys
|
|
|
|
import (
|
|
"charm.land/bubbles/v2/key"
|
|
"github.com/anotherhadi/spilltea/internal/config"
|
|
)
|
|
|
|
type InterceptKeyMap struct {
|
|
Forward key.Binding
|
|
ForwardAll key.Binding
|
|
Drop key.Binding
|
|
DropAll key.Binding
|
|
ToggleIntercept key.Binding
|
|
CaptureResponse key.Binding
|
|
UndoEdits key.Binding
|
|
Edit key.Binding
|
|
EditExternal key.Binding
|
|
}
|
|
|
|
func newInterceptKeyMap(cfg config.InterceptKeys) InterceptKeyMap {
|
|
return InterceptKeyMap{
|
|
Forward: binding(cfg.Forward, "forward"),
|
|
ForwardAll: binding(cfg.ForwardAll, "forward all"),
|
|
Drop: binding(cfg.Drop, "drop"),
|
|
DropAll: binding(cfg.DropAll, "drop all"),
|
|
ToggleIntercept: binding(cfg.ToggleIntercept, "toggle intercept"),
|
|
CaptureResponse: binding(cfg.CaptureResponse, "capture response"),
|
|
UndoEdits: binding(cfg.UndoEdits, "undo edits"),
|
|
Edit: binding(cfg.Edit, "edit"),
|
|
EditExternal: binding(cfg.EditExternal, "edit in $EDITOR"),
|
|
}
|
|
}
|
|
|
|
func (ic InterceptKeyMap) Bindings() []key.Binding {
|
|
return []key.Binding{
|
|
ic.Forward, ic.ForwardAll,
|
|
ic.Drop, ic.DropAll,
|
|
ic.Edit, ic.EditExternal, ic.UndoEdits,
|
|
ic.ToggleIntercept, ic.CaptureResponse,
|
|
}
|
|
}
|