1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-02-01 13:17:53 +02:00

workaround to include menu keybinding in cheatsheet

This commit is contained in:
Dawid Dziurla 2018-09-05 15:45:20 +02:00
parent 4188786749
commit 08395ae76c
No known key found for this signature in database
GPG Key ID: 7B6D8368172E9B0B

View File

@ -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)
}