1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-08-06 22:33:07 +02:00

Add a GetShortDescription() method to Binding

This commit is contained in:
Stefan Haller
2025-07-28 14:49:22 +02:00
parent d0438b7d33
commit 9eb1e3a729
2 changed files with 8 additions and 6 deletions

View File

@ -50,14 +50,9 @@ func (self *OptionsMapMgr) renderContextOptionsMap() {
displayStyle = *binding.DisplayStyle displayStyle = *binding.DisplayStyle
} }
description := binding.Description
if binding.ShortDescription != "" {
description = binding.ShortDescription
}
return bindingInfo{ return bindingInfo{
key: keybindings.LabelFromKey(binding.Key), key: keybindings.LabelFromKey(binding.Key),
description: description, description: binding.GetShortDescription(),
style: displayStyle, style: displayStyle,
} }
}) })

View File

@ -47,6 +47,13 @@ func (b *Binding) IsDisabled() bool {
return b.GetDisabledReason != nil && b.GetDisabledReason() != nil return b.GetDisabledReason != nil && b.GetDisabledReason() != nil
} }
func (b *Binding) GetShortDescription() string {
if b.ShortDescription != "" {
return b.ShortDescription
}
return b.Description
}
// A guard is a decorator which checks something before executing a handler // A guard is a decorator which checks something before executing a handler
// and potentially early-exits if some precondition hasn't been met. // and potentially early-exits if some precondition hasn't been met.
type Guard func(func() error) func() error type Guard func(func() error) func() error