mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-12 04:45:47 +02:00
workaround to include menu keybinding in cheatsheet
This commit is contained in:
parent
4188786749
commit
08395ae76c
1 changed files with 7 additions and 1 deletions
|
@ -30,7 +30,7 @@ func main() {
|
||||||
file.WriteString("# Lazygit " + a.Tr.SLocalize("menu"))
|
file.WriteString("# Lazygit " + a.Tr.SLocalize("menu"))
|
||||||
|
|
||||||
for _, binding := range bindings {
|
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 {
|
if binding.ViewName != current {
|
||||||
current = binding.ViewName
|
current = binding.ViewName
|
||||||
if current == "" {
|
if current == "" {
|
||||||
|
@ -41,6 +41,12 @@ func main() {
|
||||||
content = fmt.Sprintf("</pre>\n\n## %s\n<pre>\n", title)
|
content = fmt.Sprintf("</pre>\n\n## %s\n<pre>\n", title)
|
||||||
file.WriteString(content)
|
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)
|
content = fmt.Sprintf("\t<kbd>%s</kbd>%s %s\n", key, strings.TrimPrefix(utils.WithPadding(key, padWidth), key), binding.Description)
|
||||||
file.WriteString(content)
|
file.WriteString(content)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue