Skip to content
Permalink
Browse files

update keybindings

  • Loading branch information...
jesseduffield committed Jun 23, 2019
1 parent e361a42 commit 799245da3852429059d20078b5ddc02e2974de85
@@ -0,0 +1,57 @@
# Lazydocker menu

## Status

<pre>
<kbd>e</kbd>: edit config container
<kbd>o</kbd>: open config container
<kbd>[</kbd>: previous tab
<kbd>]</kbd>: next tab
<kbd>m</kbd>: view logs
</pre>

## Containers

<pre>
<kbd>[</kbd>: previous tab
<kbd>]</kbd>: next tab
<kbd>d</kbd>: remove
<kbd>s</kbd>: stop
<kbd>r</kbd>: restart
<kbd>a</kbd>: attach
<kbd>D</kbd>: prune exited containers
<kbd>m</kbd>: view logs
<kbd>c</kbd>: run predefined custom command
</pre>

## Services

<pre>
<kbd>d</kbd>: remove containers
<kbd>s</kbd>: stop
<kbd>r</kbd>: restart
<kbd>a</kbd>: attach
<kbd>m</kbd>: view logs
<kbd>[</kbd>: previous tab
<kbd>]</kbd>: next tab
<kbd>R</kbd>: view restart options
<kbd>c</kbd>: run predefined custom command
</pre>

## Images

<pre>
<kbd>[</kbd>: previous tab
<kbd>]</kbd>: next tab
<kbd>d</kbd>: remove image
<kbd>D</kbd>: prune unused images
</pre>

## Volumes

<pre>
<kbd>[</kbd>: previous tab
<kbd>]</kbd>: next tab
<kbd>d</kbd>: remove volume
<kbd>D</kbd>: prune unused volumes
</pre>
@@ -0,0 +1,57 @@
# Lazydocker menu

## Status

<pre>
<kbd>e</kbd>: edit config container
<kbd>o</kbd>: open config container
<kbd>[</kbd>: previous tab
<kbd>]</kbd>: next tab
<kbd>m</kbd>: view logs
</pre>

## Containers

<pre>
<kbd>[</kbd>: previous tab
<kbd>]</kbd>: next tab
<kbd>d</kbd>: remove
<kbd>s</kbd>: stop
<kbd>r</kbd>: restart
<kbd>a</kbd>: attach
<kbd>D</kbd>: prune exited containers
<kbd>m</kbd>: view logs
<kbd>c</kbd>: run predefined custom command
</pre>

## Services

<pre>
<kbd>d</kbd>: remove containers
<kbd>s</kbd>: stop
<kbd>r</kbd>: restart
<kbd>a</kbd>: attach
<kbd>m</kbd>: view logs
<kbd>[</kbd>: previous tab
<kbd>]</kbd>: next tab
<kbd>R</kbd>: view restart options
<kbd>c</kbd>: run predefined custom command
</pre>

## Images

<pre>
<kbd>[</kbd>: previous tab
<kbd>]</kbd>: next tab
<kbd>d</kbd>: remove image
<kbd>D</kbd>: prune unused images
</pre>

## Volumes

<pre>
<kbd>[</kbd>: previous tab
<kbd>]</kbd>: next tab
<kbd>d</kbd>: remove volume
<kbd>D</kbd>: prune unused volumes
</pre>
@@ -0,0 +1,57 @@
# Lazydocker menu

## Status

<pre>
<kbd>e</kbd>: edit config container
<kbd>o</kbd>: open config container
<kbd>[</kbd>: previous tab
<kbd>]</kbd>: next tab
<kbd>m</kbd>: view logs
</pre>

## Containers

<pre>
<kbd>[</kbd>: previous tab
<kbd>]</kbd>: next tab
<kbd>d</kbd>: remove
<kbd>s</kbd>: stop
<kbd>r</kbd>: restart
<kbd>a</kbd>: attach
<kbd>D</kbd>: prune exited containers
<kbd>m</kbd>: view logs
<kbd>c</kbd>: run predefined custom command
</pre>

## Services

<pre>
<kbd>d</kbd>: remove containers
<kbd>s</kbd>: stop
<kbd>r</kbd>: restart
<kbd>a</kbd>: attach
<kbd>m</kbd>: view logs
<kbd>[</kbd>: previous tab
<kbd>]</kbd>: next tab
<kbd>R</kbd>: view restart options
<kbd>c</kbd>: run predefined custom command
</pre>

## Images

<pre>
<kbd>[</kbd>: previous tab
<kbd>]</kbd>: next tab
<kbd>d</kbd>: remove image
<kbd>D</kbd>: prune unused images
</pre>

## Volumes

<pre>
<kbd>[</kbd>: previous tab
<kbd>]</kbd>: next tab
<kbd>d</kbd>: remove volume
<kbd>D</kbd>: prune unused volumes
</pre>
@@ -6,6 +6,8 @@ type TranslationSet struct {
ErrorMessage string
NotEnoughSpace string
StatusTitle string
MainTitle string
GlobalTitle string
Navigate string
Menu string
Execute string
@@ -123,6 +125,8 @@ func englishSet() TranslationSet {
AnonymousReportingTitle: "Help make lazydocker better",
AnonymousReportingPrompt: "Would you like to enable anonymous reporting data to help improve lazydocker? (enter/esc)",

GlobalTitle: "Global",
MainTitle: "Main",
StatusTitle: "Status",
ServicesTitle: "Services",
ContainersTitle: "Containers",
@@ -26,7 +26,10 @@ type bindingSection struct {

func main() {
langs := []string{"pl", "nl", "en"}
mConfig, _ := config.NewAppConfig("", "", "", "", "", true)
mConfig, err := config.NewAppConfig("lazydocker", "", "", "", "", true)
if err != nil {
panic(err)
}

for _, lang := range langs {
os.Setenv("LC_ALL", lang)
@@ -49,12 +52,6 @@ func writeString(file *os.File, str string) {
}
}

func localisedTitle(mApp *app.App, str string) string {
return ""
// viewTitle := strings.Title(str) + "Title"
// return mApp.Tr.ViewTitle // FIXME: this used to be dynamic but we can't make this dynamic again without reflection since we're now using a struct of translation strings
}

func formatTitle(title string) string {
return fmt.Sprintf("\n## %s\n\n", title)
}
@@ -66,7 +63,6 @@ func formatBinding(binding *gui.Binding) string {
func getBindingSections(mApp *app.App) []*bindingSection {
bindingSections := []*bindingSection{}

// TODO: add context-based keybindings
for _, binding := range mApp.Gui.GetInitialKeybindings() {
if binding.Description == "" {
continue
@@ -76,9 +72,18 @@ func getBindingSections(mApp *app.App) []*bindingSection {
if viewName == "" {
viewName = "global"
}
title := localisedTitle(mApp, viewName)

bindingSections = addBinding(title, bindingSections, binding)
titleMap := map[string]string{
"global": mApp.Tr.GlobalTitle,
"main": mApp.Tr.MainTitle,
"status": mApp.Tr.StatusTitle,
"services": mApp.Tr.ServicesTitle,
"containers": mApp.Tr.ContainersTitle,
"images": mApp.Tr.ImagesTitle,
"volumes": mApp.Tr.VolumesTitle,
}

bindingSections = addBinding(titleMap[viewName], bindingSections, binding)
}

// for view, contexts := range mApp.Gui.GetContextMap() {

0 comments on commit 799245d

Please sign in to comment.
You can’t perform that action at this time.