summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorDawid Dziurla <dawidd0811@gmail.com>2018-09-05 13:01:21 +0200
committerDawid Dziurla <dawidd0811@gmail.com>2018-09-05 13:16:40 +0200
commit906f8e252e43c1dbd2303fb90de660a2181e5f32 (patch)
tree25941fd431e59485485d0f6a8eef76daccf5f6db /scripts
parent557009e660e3203dce62624599c173e25f086465 (diff)
include global keybindings in menu
Diffstat (limited to 'scripts')
-rw-r--r--scripts/generate_cheatsheet.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/scripts/generate_cheatsheet.go b/scripts/generate_cheatsheet.go
index 2c18e5f03..95012e2a4 100644
--- a/scripts/generate_cheatsheet.go
+++ b/scripts/generate_cheatsheet.go
@@ -12,6 +12,7 @@ import (
"github.com/jesseduffield/lazygit/pkg/app"
"github.com/jesseduffield/lazygit/pkg/config"
+ "github.com/jesseduffield/lazygit/pkg/utils"
)
func main() {
@@ -20,9 +21,11 @@ func main() {
lang := a.Tr.GetLanguage()
name := "Keybindings_" + lang + ".md"
bindings := a.Gui.GetKeybindings()
+ padWidth := a.Gui.GetMaxKeyLength(bindings)
file, _ := os.Create(name)
- current := ""
+ current := "v"
content := ""
+ title := ""
file.WriteString("# Lazygit " + a.Tr.SLocalize("menu"))
@@ -30,11 +33,15 @@ func main() {
if key := a.Gui.GetKey(binding); key != "" && binding.Description != "" {
if binding.ViewName != current {
current = binding.ViewName
- title := a.Tr.SLocalize(strings.Title(current) + "Title")
+ if current == "" {
+ title = a.Tr.SLocalize("GlobalTitle")
+ } else {
+ title = a.Tr.SLocalize(strings.Title(current) + "Title")
+ }
content = fmt.Sprintf("</pre>\n\n## %s\n<pre>\n", title)
file.WriteString(content)
}
- content = fmt.Sprintf("\t<kbd>%s</kbd>:\t%s\n", key, binding.Description)
+ content = fmt.Sprintf("\t<kbd>%s</kbd>%s %s\n", key, strings.TrimPrefix(utils.WithPadding(key, padWidth), key), binding.Description)
file.WriteString(content)
}
}