mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-25 08:31:03 +00:00
Config: Added a lot of default keybindings
* Cleaned up some code * Added missing configs * Added documentation * Implemented config referencing to keybindings.go Signed-off-by: Glenn Vriesman <glenn.vriesman@gmail.com>
This commit is contained in:
parent
e7c1e5d6c5
commit
d62785cecd
2 changed files with 136 additions and 183 deletions
|
|
@ -269,6 +269,12 @@ type KeybindingsConfig struct {
|
||||||
// ScrollDownMain represents all the keys that will scroll down the main view
|
// ScrollDownMain represents all the keys that will scroll down the main view
|
||||||
ScrollDownMain []string `yaml:"scrollDownMain,omitempty"`
|
ScrollDownMain []string `yaml:"scrollDownMain,omitempty"`
|
||||||
|
|
||||||
|
// ScrollLeftMain represents all the keys that will scroll the main view to the left
|
||||||
|
ScrollLeftMain []string `yaml:"scrollLeftMain,omitempty"`
|
||||||
|
|
||||||
|
// ScrollRightMain represents all the keys that will scroll the main view to the right
|
||||||
|
ScrollRightMain []string `yaml:"scrollRightMain,omitempty"`
|
||||||
|
|
||||||
// AutoScrollMain represents all the keys that will toggle autoscroll
|
// AutoScrollMain represents all the keys that will toggle autoscroll
|
||||||
AutoScrollMain []string `yaml:"autoScrollMain,omitempty"`
|
AutoScrollMain []string `yaml:"autoScrollMain,omitempty"`
|
||||||
|
|
||||||
|
|
@ -309,6 +315,7 @@ type KeybindingsConfig struct {
|
||||||
Main Main `yaml:"main,omitempty"`
|
Main Main `yaml:"main,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Project represents all the keys that are applied to the project view
|
||||||
type Project struct {
|
type Project struct {
|
||||||
// EditConfig represents all the keys that will open the edit view
|
// EditConfig represents all the keys that will open the edit view
|
||||||
EditConfig []string `yaml:"editConfig,omitempty"`
|
EditConfig []string `yaml:"editConfig,omitempty"`
|
||||||
|
|
@ -337,7 +344,6 @@ type Information struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Containers struct {
|
type Containers struct {
|
||||||
|
|
||||||
// Remove represents all the keys that will remove the selected container
|
// Remove represents all the keys that will remove the selected container
|
||||||
Remove []string `yaml:"remove,omitempty"`
|
Remove []string `yaml:"remove,omitempty"`
|
||||||
|
|
||||||
|
|
@ -353,14 +359,14 @@ type Containers struct {
|
||||||
// Attach represents all the keys that will attach the selected container
|
// Attach represents all the keys that will attach the selected container
|
||||||
Attach []string `yaml:"attach,omitempty"`
|
Attach []string `yaml:"attach,omitempty"`
|
||||||
|
|
||||||
// Prune represents all the keys that will prune the containers
|
|
||||||
Prune []string `yaml:"prune,omitempty"`
|
|
||||||
|
|
||||||
// ViewLogs represents all the keys that will show you the logs
|
// ViewLogs represents all the keys that will show you the logs
|
||||||
ViewLogs []string `yaml:"viewLogs,omitempty"`
|
ViewLogs []string `yaml:"viewLogs,omitempty"`
|
||||||
|
|
||||||
// RunCustomCommand represents all the keys that will run a custom command
|
// RunCustomCommand represents all the keys that will run a custom command
|
||||||
RunCustomCommand []string `yaml:"runCustomCommand,omitempty"`
|
RunCustomCommand []string `yaml:"runCustomCommand,omitempty"`
|
||||||
|
|
||||||
|
// RunBulkCommands represents all the keys that will show you the bulk commands
|
||||||
|
RunBulkCommands []string `yaml:"runBulkCommands,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Services struct {
|
type Services struct {
|
||||||
|
|
@ -384,24 +390,40 @@ type Services struct {
|
||||||
|
|
||||||
// RunCustomCommand represents all the keys that will run a custom command
|
// RunCustomCommand represents all the keys that will run a custom command
|
||||||
RunCustomCommand []string `yaml:"runCustomCommand,omitempty"`
|
RunCustomCommand []string `yaml:"runCustomCommand,omitempty"`
|
||||||
|
|
||||||
|
// RunBulkCommands represents all the keys that will show you the bulk commands
|
||||||
|
RunBulkCommands []string `yaml:"runBulkCommands,omitempty"`
|
||||||
|
|
||||||
|
// ScrollUpMain represents all the keys that will scroll up the main view
|
||||||
|
ScrollUpMain []string
|
||||||
|
|
||||||
|
// RunBulkCommands represents all the keys that will scroll down the main view
|
||||||
|
ScrollDownMain []string
|
||||||
}
|
}
|
||||||
|
|
||||||
type Images struct {
|
type Images struct {
|
||||||
// Remove represents all the keys that will remove the selected image
|
// Remove represents all the keys that will remove the selected image
|
||||||
Remove []string `yaml:"remove,omitempty"`
|
Remove []string `yaml:"remove,omitempty"`
|
||||||
|
|
||||||
// Prune represents all the keys that will prune the images
|
// RunCustomCommand represents all the keys that will run a custom command
|
||||||
Prune []string `yaml:"prune,omitempty"`
|
RunCustomCommand []string `yaml:"runCustomCommand,omitempty"`
|
||||||
|
|
||||||
|
// RunBulkCommand represents all the
|
||||||
|
RunBulkCommands []string `yaml:"runBulkCommands,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Volumes struct {
|
type Volumes struct {
|
||||||
// Remove represents all the keys that will remove the selected volume
|
// Remove represents all the keys that will remove the selected volume
|
||||||
Remove []string `yaml:"remove,omitempty"`
|
Remove []string `yaml:"remove,omitempty"`
|
||||||
|
|
||||||
// Prune represents all the keys that will prune the volumes
|
// RunCustomCommand represents all the keys that will run a custom command
|
||||||
Prune []string `yaml:"prune,omitempty"`
|
RunCustomCommand []string `yaml:"runCustomCommand,omitempty"`
|
||||||
|
|
||||||
|
// RunBulkCommand represents all the
|
||||||
|
RunBulkCommands []string `yaml:"runBulkCommands,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Main represents all the keys that are applied to the main view
|
||||||
type Main struct {
|
type Main struct {
|
||||||
// Return represents all the keys that will trigger a return
|
// Return represents all the keys that will trigger a return
|
||||||
Return []string `yaml:"return,omitempty"`
|
Return []string `yaml:"return,omitempty"`
|
||||||
|
|
@ -411,12 +433,6 @@ type Main struct {
|
||||||
|
|
||||||
// ScrollLeft represents all the keys that will scroll the main view to the right
|
// ScrollLeft represents all the keys that will scroll the main view to the right
|
||||||
ScrollRight []string `yaml:"scrollRight,omitempty"`
|
ScrollRight []string `yaml:"scrollRight,omitempty"`
|
||||||
|
|
||||||
// ScrollLeft represents all the keys that will scroll the main view down
|
|
||||||
ScrolDown []string `yaml:"scrolDown,omitempty"`
|
|
||||||
|
|
||||||
// ScrollLeft represents all the keys that will scroll the main view up
|
|
||||||
ScrollUp []string `yaml:"scrollUp,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CustomCommands contains the custom commands that you might want to use on any
|
// CustomCommands contains the custom commands that you might want to use on any
|
||||||
|
|
@ -582,60 +598,63 @@ func GetDefaultConfig() UserConfig {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Keybindings: KeybindingsConfig{
|
Keybindings: KeybindingsConfig{
|
||||||
Quit: []string{},
|
Quit: []string{"q", "ctrl+c", "escape"},
|
||||||
ScrollUpMain: []string{},
|
ScrollUpMain: []string{"pageup", "ctrl+u", "K"},
|
||||||
ScrollDownMain: []string{},
|
ScrollDownMain: []string{"pagedown", "ctrl+d", "J"},
|
||||||
AutoScrollMain: []string{},
|
ScrollLeftMain: []string{"H"},
|
||||||
ShowOptionsMenu: []string{},
|
ScrollRightMain: []string{"L"},
|
||||||
CustomCommand: []string{},
|
AutoScrollMain: []string{"end"},
|
||||||
PreviousContext: []string{},
|
ShowOptionsMenu: []string{"x", "?"},
|
||||||
NextContext: []string{},
|
CustomCommand: []string{"X"},
|
||||||
|
PreviousContext: []string{"["},
|
||||||
|
NextContext: []string{"]"},
|
||||||
Project: Project{
|
Project: Project{
|
||||||
EditConfig: []string{},
|
EditConfig: []string{"e"},
|
||||||
OpenConfig: []string{},
|
OpenConfig: []string{"o"},
|
||||||
Click: []string{},
|
Click: []string{"MouseLeft"},
|
||||||
ViewLogs: []string{},
|
ViewLogs: []string{"m"},
|
||||||
Select: []string{},
|
Select: []string{"MouseLeft"},
|
||||||
},
|
},
|
||||||
Menu: Menu{
|
Menu: Menu{
|
||||||
Close: []string{},
|
Close: []string{"Escape", "q"},
|
||||||
},
|
},
|
||||||
Information: Information{
|
Information: Information{
|
||||||
Donate: []string{},
|
Donate: []string{"MouseLeft"},
|
||||||
},
|
},
|
||||||
Containers: Containers{
|
Containers: Containers{
|
||||||
Remove: []string{},
|
Remove: []string{"d"},
|
||||||
HideStopped: []string{},
|
HideStopped: []string{"e"},
|
||||||
Stop: []string{},
|
Stop: []string{"s"},
|
||||||
Restart: []string{},
|
Restart: []string{"r"},
|
||||||
Attach: []string{},
|
Attach: []string{"a"},
|
||||||
Prune: []string{},
|
ViewLogs: []string{"m"},
|
||||||
ViewLogs: []string{},
|
RunCustomCommand: []string{"c"},
|
||||||
RunCustomCommand: []string{},
|
RunBulkCommands: []string{"b"},
|
||||||
},
|
},
|
||||||
Services: Services{
|
Services: Services{
|
||||||
Remove: []string{},
|
Remove: []string{"d"},
|
||||||
Stop: []string{},
|
Stop: []string{"s"},
|
||||||
Restart: []string{},
|
Restart: []string{"r"},
|
||||||
Attach: []string{},
|
Attach: []string{"a"},
|
||||||
ViewLogs: []string{},
|
ViewLogs: []string{"m"},
|
||||||
ViewRestartOptions: []string{},
|
ViewRestartOptions: []string{"R"},
|
||||||
RunCustomCommand: []string{},
|
RunCustomCommand: []string{"c"},
|
||||||
|
RunBulkCommands: []string{"b"},
|
||||||
},
|
},
|
||||||
Images: Images{
|
Images: Images{
|
||||||
Remove: []string{},
|
Remove: []string{"d"},
|
||||||
Prune: []string{},
|
RunCustomCommand: []string{"c"},
|
||||||
|
RunBulkCommands: []string{"b"},
|
||||||
},
|
},
|
||||||
Volumes: Volumes{
|
Volumes: Volumes{
|
||||||
Remove: []string{},
|
Remove: []string{"d"},
|
||||||
Prune: []string{},
|
RunCustomCommand: []string{"c"},
|
||||||
|
RunBulkCommands: []string{"b"},
|
||||||
},
|
},
|
||||||
Main: Main{
|
Main: Main{
|
||||||
Return: []string{},
|
Return: []string{"Escape"},
|
||||||
ScrollLeft: []string{},
|
ScrollLeft: []string{"left", "h"},
|
||||||
ScrollRight: []string{},
|
ScrollRight: []string{"right", "l"},
|
||||||
ScrolDown: []string{},
|
|
||||||
ScrollUp: []string{},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import (
|
||||||
type Binding struct {
|
type Binding struct {
|
||||||
ViewName string
|
ViewName string
|
||||||
Handler func(*gocui.Gui, *gocui.View) error
|
Handler func(*gocui.Gui, *gocui.View) error
|
||||||
Key interface{} // FIXME: find out how to get `gocui.Key | rune`
|
Keys []gocui.Key
|
||||||
Modifier gocui.Modifier
|
Modifier gocui.Modifier
|
||||||
Description string
|
Description string
|
||||||
}
|
}
|
||||||
|
|
@ -61,411 +61,337 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
|
||||||
bindings := []*Binding{
|
bindings := []*Binding{
|
||||||
{
|
{
|
||||||
ViewName: "",
|
ViewName: "",
|
||||||
Key: 'q',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybindings.Quit),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.quit,
|
Handler: gui.quit,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "",
|
ViewName: "",
|
||||||
Key: gocui.KeyCtrlC,
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybindings.ScrollUpMain),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.quit,
|
Handler: gui.quit,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "",
|
ViewName: "",
|
||||||
Key: gocui.KeyEsc,
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybindings.ScrollDownMain),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.quit,
|
Handler: gui.quit,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "",
|
ViewName: "",
|
||||||
Key: gocui.KeyPgup,
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybindings.ScrollLeftMain),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.scrollUpMain,
|
Handler: gui.scrollLeftMain,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "",
|
ViewName: "",
|
||||||
Key: gocui.KeyPgdn,
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybindings.ScrollRightMain),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.scrollDownMain,
|
Handler: gui.scrollRightMain,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "",
|
ViewName: "",
|
||||||
Key: gocui.KeyCtrlU,
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybindings.AutoScrollMain),
|
||||||
Modifier: gocui.ModNone,
|
|
||||||
Handler: gui.scrollUpMain,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ViewName: "",
|
|
||||||
Key: gocui.KeyCtrlD,
|
|
||||||
Modifier: gocui.ModNone,
|
|
||||||
Handler: gui.scrollDownMain,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ViewName: "",
|
|
||||||
Key: gocui.KeyEnd,
|
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.autoScrollMain,
|
Handler: gui.autoScrollMain,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "",
|
ViewName: "",
|
||||||
Key: 'x',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybindings.ShowOptionsMenu),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleCreateOptionsMenu,
|
Handler: gui.handleCreateOptionsMenu,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "",
|
ViewName: "",
|
||||||
Key: '?',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybindings.CustomCommand),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleCreateOptionsMenu,
|
Handler: gui.handleCustomCommand, // Might overlap with the other run custom command configs
|
||||||
},
|
|
||||||
{
|
|
||||||
ViewName: "",
|
|
||||||
Key: 'X',
|
|
||||||
Modifier: gocui.ModNone,
|
|
||||||
Handler: gui.handleCustomCommand,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "project",
|
ViewName: "project",
|
||||||
Key: 'e',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.Project.EditConfig),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleEditConfig,
|
Handler: gui.handleEditConfig,
|
||||||
Description: gui.Tr.EditConfig,
|
Description: gui.Tr.EditConfig,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "project",
|
ViewName: "project",
|
||||||
Key: 'o',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.Project.OpenConfig),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleOpenConfig,
|
Handler: gui.handleOpenConfig,
|
||||||
Description: gui.Tr.OpenConfig,
|
Description: gui.Tr.OpenConfig,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "project",
|
ViewName: "project",
|
||||||
Key: '[',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.PreviousContext),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleProjectPrevContext,
|
Handler: gui.handleProjectPrevContext,
|
||||||
Description: gui.Tr.PreviousContext,
|
Description: gui.Tr.PreviousContext,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "project",
|
ViewName: "project",
|
||||||
Key: ']',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.NextContext),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleProjectNextContext,
|
Handler: gui.handleProjectNextContext,
|
||||||
Description: gui.Tr.NextContext,
|
Description: gui.Tr.NextContext,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "project",
|
ViewName: "project",
|
||||||
Key: gocui.MouseLeft,
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.Project.Click),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleProjectClick,
|
Handler: gui.handleProjectClick, // Possbile dub with select
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "project",
|
ViewName: "project",
|
||||||
Key: 'm',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.Project.ViewLogs),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleViewAllLogs,
|
Handler: gui.handleViewAllLogs,
|
||||||
Description: gui.Tr.ViewLogs,
|
Description: gui.Tr.ViewLogs,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "project",
|
ViewName: "project",
|
||||||
Key: gocui.MouseLeft,
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.Project.Select),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleProjectSelect,
|
Handler: gui.handleProjectSelect, // Possible dub with click
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "menu",
|
ViewName: "menu",
|
||||||
Key: gocui.KeyEsc,
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.Menu.Close),
|
||||||
Modifier: gocui.ModNone,
|
|
||||||
Handler: gui.handleMenuClose,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ViewName: "menu",
|
|
||||||
Key: 'q',
|
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleMenuClose,
|
Handler: gui.handleMenuClose,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "information",
|
ViewName: "information",
|
||||||
Key: gocui.MouseLeft,
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.Information.Donate),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleDonate,
|
Handler: gui.handleDonate,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "containers",
|
ViewName: "containers",
|
||||||
Key: '[',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.PreviousContext),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleContainersPrevContext,
|
Handler: gui.handleContainersPrevContext,
|
||||||
Description: gui.Tr.PreviousContext,
|
Description: gui.Tr.PreviousContext,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "containers",
|
ViewName: "containers",
|
||||||
Key: ']',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.NextContext),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleContainersNextContext,
|
Handler: gui.handleContainersNextContext,
|
||||||
Description: gui.Tr.NextContext,
|
Description: gui.Tr.NextContext,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "containers",
|
ViewName: "containers",
|
||||||
Key: 'd',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.Containers.Remove),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleContainersRemoveMenu,
|
Handler: gui.handleContainersRemoveMenu,
|
||||||
Description: gui.Tr.Remove,
|
Description: gui.Tr.Remove,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "containers",
|
ViewName: "containers",
|
||||||
Key: 'e',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.Containers.HideStopped),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleHideStoppedContainers,
|
Handler: gui.handleHideStoppedContainers,
|
||||||
Description: gui.Tr.HideStopped,
|
Description: gui.Tr.HideStopped,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "containers",
|
ViewName: "containers",
|
||||||
Key: 's',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.Containers.Stop),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleContainerStop,
|
Handler: gui.handleContainerStop,
|
||||||
Description: gui.Tr.Stop,
|
Description: gui.Tr.Stop,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "containers",
|
ViewName: "containers",
|
||||||
Key: 'r',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.Containers.Restart),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleContainerRestart,
|
Handler: gui.handleContainerRestart,
|
||||||
Description: gui.Tr.Restart,
|
Description: gui.Tr.Restart,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "containers",
|
ViewName: "containers",
|
||||||
Key: 'a',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.Containers.Attach),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleContainerAttach,
|
Handler: gui.handleContainerAttach,
|
||||||
Description: gui.Tr.Attach,
|
Description: gui.Tr.Attach,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "containers",
|
ViewName: "containers",
|
||||||
Key: 'm',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.Containers.ViewLogs),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleContainerViewLogs,
|
Handler: gui.handleContainerViewLogs,
|
||||||
Description: gui.Tr.ViewLogs,
|
Description: gui.Tr.ViewLogs,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "containers",
|
ViewName: "containers",
|
||||||
Key: 'c',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.Containers.RunCustomCommand),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleContainersCustomCommand,
|
Handler: gui.handleContainersCustomCommand,
|
||||||
Description: gui.Tr.RunCustomCommand,
|
Description: gui.Tr.RunCustomCommand,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "containers",
|
ViewName: "containers",
|
||||||
Key: 'b',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.Containers.RunBulkCommands),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleContainersBulkCommand,
|
Handler: gui.handleContainersBulkCommand,
|
||||||
Description: gui.Tr.ViewBulkCommands,
|
Description: gui.Tr.ViewBulkCommands,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "services",
|
ViewName: "services",
|
||||||
Key: 'd',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.Services.Remove),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleServiceRemoveMenu,
|
Handler: gui.handleServiceRemoveMenu,
|
||||||
Description: gui.Tr.RemoveService,
|
Description: gui.Tr.RemoveService,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "services",
|
ViewName: "services",
|
||||||
Key: 's',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.Services.Stop),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleServiceStop,
|
Handler: gui.handleServiceStop,
|
||||||
Description: gui.Tr.Stop,
|
Description: gui.Tr.Stop,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "services",
|
ViewName: "services",
|
||||||
Key: 'r',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.Services.Restart),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleServiceRestart,
|
Handler: gui.handleServiceRestart,
|
||||||
Description: gui.Tr.Restart,
|
Description: gui.Tr.Restart,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "services",
|
ViewName: "services",
|
||||||
Key: 'a',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.Services.Attach),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleServiceAttach,
|
Handler: gui.handleServiceAttach,
|
||||||
Description: gui.Tr.Attach,
|
Description: gui.Tr.Attach,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "services",
|
ViewName: "services",
|
||||||
Key: 'm',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.Services.ViewLogs),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleServiceViewLogs,
|
Handler: gui.handleServiceViewLogs,
|
||||||
Description: gui.Tr.ViewLogs,
|
Description: gui.Tr.ViewLogs,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "services",
|
ViewName: "services",
|
||||||
Key: '[',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.PreviousContext),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleServicesPrevContext,
|
Handler: gui.handleServicesPrevContext,
|
||||||
Description: gui.Tr.PreviousContext,
|
Description: gui.Tr.PreviousContext,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "services",
|
ViewName: "services",
|
||||||
Key: ']',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.NextContext),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleServicesNextContext,
|
Handler: gui.handleServicesNextContext,
|
||||||
Description: gui.Tr.NextContext,
|
Description: gui.Tr.NextContext,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "services",
|
ViewName: "services",
|
||||||
Key: 'R',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.Services.ViewRestartOptions),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleServiceRestartMenu,
|
Handler: gui.handleServiceRestartMenu,
|
||||||
Description: gui.Tr.ViewRestartOptions,
|
Description: gui.Tr.ViewRestartOptions,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "services",
|
ViewName: "services",
|
||||||
Key: 'c',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.Services.RunCustomCommand),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleServicesCustomCommand,
|
Handler: gui.handleServicesCustomCommand,
|
||||||
Description: gui.Tr.RunCustomCommand,
|
Description: gui.Tr.RunCustomCommand,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "services",
|
ViewName: "services",
|
||||||
Key: 'b',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.Services.RunBulkCommands),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleServicesBulkCommand,
|
Handler: gui.handleServicesBulkCommand,
|
||||||
Description: gui.Tr.ViewBulkCommands,
|
Description: gui.Tr.ViewBulkCommands,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "images",
|
ViewName: "images",
|
||||||
Key: '[',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.PreviousContext),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleImagesPrevContext,
|
Handler: gui.handleImagesPrevContext,
|
||||||
Description: gui.Tr.PreviousContext,
|
Description: gui.Tr.PreviousContext,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "images",
|
ViewName: "images",
|
||||||
Key: ']',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.NextContext),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleImagesNextContext,
|
Handler: gui.handleImagesNextContext,
|
||||||
Description: gui.Tr.NextContext,
|
Description: gui.Tr.NextContext,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "images",
|
ViewName: "images",
|
||||||
Key: 'c',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybindings.Images.RunCustomCommand),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleImagesCustomCommand,
|
Handler: gui.handleImagesCustomCommand,
|
||||||
Description: gui.Tr.RunCustomCommand,
|
Description: gui.Tr.RunCustomCommand,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "images",
|
ViewName: "images",
|
||||||
Key: 'd',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybindings.Images.Remove),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleImagesRemoveMenu,
|
Handler: gui.handleImagesRemoveMenu,
|
||||||
Description: gui.Tr.RemoveImage,
|
Description: gui.Tr.RemoveImage,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "images",
|
ViewName: "images",
|
||||||
Key: 'b',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybindings.Images.RunBulkCommands),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleImagesBulkCommand,
|
Handler: gui.handleImagesBulkCommand,
|
||||||
Description: gui.Tr.ViewBulkCommands,
|
Description: gui.Tr.ViewBulkCommands,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
ViewName: "images",
|
|
||||||
Key: 'c',
|
|
||||||
Modifier: gocui.ModNone,
|
|
||||||
Handler: gui.handleImagesCustomCommand,
|
|
||||||
Description: gui.Tr.RunCustomCommand,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
ViewName: "volumes",
|
ViewName: "volumes",
|
||||||
Key: '[',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.PreviousContext),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleVolumesPrevContext,
|
Handler: gui.handleVolumesPrevContext,
|
||||||
Description: gui.Tr.PreviousContext,
|
Description: gui.Tr.PreviousContext,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "volumes",
|
ViewName: "volumes",
|
||||||
Key: ']',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybinding.NextContext),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleVolumesNextContext,
|
Handler: gui.handleVolumesNextContext,
|
||||||
Description: gui.Tr.NextContext,
|
Description: gui.Tr.NextContext,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "volumes",
|
ViewName: "volumes",
|
||||||
Key: 'c',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybindings.Volumes.RunCustomCommand),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleVolumesCustomCommand,
|
Handler: gui.handleVolumesCustomCommand,
|
||||||
Description: gui.Tr.RunCustomCommand,
|
Description: gui.Tr.RunCustomCommand,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "volumes",
|
ViewName: "volumes",
|
||||||
Key: 'd',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybindings.Volumes.Remove),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleVolumesRemoveMenu,
|
Handler: gui.handleVolumesRemoveMenu,
|
||||||
Description: gui.Tr.RemoveVolume,
|
Description: gui.Tr.RemoveVolume,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "volumes",
|
ViewName: "volumes",
|
||||||
Key: 'b',
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybindings.Volumes.RunBulkCommands),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleVolumesBulkCommand,
|
Handler: gui.handleVolumesBulkCommand,
|
||||||
Description: gui.Tr.ViewBulkCommands,
|
Description: gui.Tr.ViewBulkCommands,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
ViewName: "volumes",
|
|
||||||
Key: 'c',
|
|
||||||
Modifier: gocui.ModNone,
|
|
||||||
Handler: gui.handleVolumesCustomCommand,
|
|
||||||
Description: gui.Tr.RunCustomCommand,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Key: gocui.KeyEsc,
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybindings.Main.Return),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleExitMain,
|
Handler: gui.handleExitMain,
|
||||||
Description: gui.Tr.Return,
|
Description: gui.Tr.Return,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Key: gocui.KeyArrowLeft,
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybindings.Main.ScrollLeft),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.scrollLeftMain,
|
Handler: gui.scrollLeftMain,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Key: gocui.KeyArrowRight,
|
Keys: parsedKeybindings(gui.Config.UserConfig.Keybindings.Main.ScrollRight),
|
||||||
Modifier: gocui.ModNone,
|
|
||||||
Handler: gui.scrollRightMain,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ViewName: "main",
|
|
||||||
Key: 'h',
|
|
||||||
Modifier: gocui.ModNone,
|
|
||||||
Handler: gui.scrollLeftMain,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ViewName: "main",
|
|
||||||
Key: 'l',
|
|
||||||
Modifier: gocui.ModNone,
|
|
||||||
Handler: gui.scrollRightMain,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ViewName: "",
|
|
||||||
Key: 'J',
|
|
||||||
Modifier: gocui.ModNone,
|
|
||||||
Handler: gui.scrollDownMain,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ViewName: "",
|
|
||||||
Key: 'K',
|
|
||||||
Modifier: gocui.ModNone,
|
|
||||||
Handler: gui.scrollUpMain,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ViewName: "",
|
|
||||||
Key: 'H',
|
|
||||||
Modifier: gocui.ModNone,
|
|
||||||
Handler: gui.scrollLeftMain,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ViewName: "",
|
|
||||||
Key: 'L',
|
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.scrollRightMain,
|
Handler: gui.scrollRightMain,
|
||||||
},
|
},
|
||||||
|
|
@ -534,3 +460,11 @@ func (gui *Gui) keybindings(g *gocui.Gui) error {
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func parsedKeybindings(binds []string) []gocui.Key {
|
||||||
|
var keys []gocui.Key
|
||||||
|
for _, bind := range binds {
|
||||||
|
keys = append(keys, keybindings.MustParse(bind)) // MustParse panics on failure
|
||||||
|
}
|
||||||
|
return keys
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue