diff options
author | Dawid Dziurla <dawidd0811@gmail.com> | 2018-09-05 15:45:20 +0200 |
---|---|---|
committer | Dawid Dziurla <dawidd0811@gmail.com> | 2018-09-05 15:45:20 +0200 |
commit | 08395ae76ca811f1d60d1af42ee1f29eaa269de5 (patch) | |
tree | 97b37dae42a0c009b988567a58d3d12c42d57901 /scripts | |
parent | 4188786749c512370d278849beef7998b72b171a (diff) |
workaround to include menu keybinding in cheatsheet
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/generate_cheatsheet.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/generate_cheatsheet.go b/scripts/generate_cheatsheet.go index 95012e2a4..863089014 100644 --- a/scripts/generate_cheatsheet.go +++ b/scripts/generate_cheatsheet.go @@ -30,7 +30,7 @@ func main() { file.WriteString("# Lazygit " + a.Tr.SLocalize("menu")) for _, binding := range bindings { - if key := a.Gui.GetKey(binding); key != "" && binding.Description != "" { + if key := a.Gui.GetKey(binding); key != "" && (binding.Description != "" || key == "?") { if binding.ViewName != current { current = binding.ViewName if current == "" { @@ -41,6 +41,12 @@ func main() { content = fmt.Sprintf("</pre>\n\n## %s\n<pre>\n", title) file.WriteString(content) } + // workaround to include menu keybinding in cheatsheet + // could not add this Description field directly to keybindings.go, + // because then menu key would be displayed in menu itself and that is undesirable + if key == "?" { + binding.Description = a.Tr.SLocalize("menu") + } content = fmt.Sprintf("\t<kbd>%s</kbd>%s %s\n", key, strings.TrimPrefix(utils.WithPadding(key, padWidth), key), binding.Description) file.WriteString(content) } |