Skip to content

Commit

Permalink
workaround to include menu keybinding in cheatsheet
Browse files Browse the repository at this point in the history
  • Loading branch information
dawidd6 committed Sep 5, 2018
1 parent 4188786 commit 08395ae
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion scripts/generate_cheatsheet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 == "" {
Expand All @@ -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)
}
Expand Down

0 comments on commit 08395ae

Please sign in to comment.