summaryrefslogtreecommitdiffstats
path: root/pkg/gui/custom_commands.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-09-27 11:29:10 +1000
committerJesse Duffield <jessedduffield@gmail.com>2020-09-27 11:32:54 +1000
commitde482262e12e989f3d4bede2057d2f0f2402e0ae (patch)
treeb58489beb5440ca30fbcd82879ddfd20da22bdd3 /pkg/gui/custom_commands.go
parent1b39c829accab89a1efe0b900de083e9f127222d (diff)
support setting description in custom command
Diffstat (limited to 'pkg/gui/custom_commands.go')
-rw-r--r--pkg/gui/custom_commands.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/pkg/gui/custom_commands.go b/pkg/gui/custom_commands.go
index 034dd3381..d13c2d918 100644
--- a/pkg/gui/custom_commands.go
+++ b/pkg/gui/custom_commands.go
@@ -199,6 +199,7 @@ type CustomCommand struct {
Subprocess bool `yaml:"subprocess"`
Prompts []CustomCommandPrompt `yaml:"prompts"`
LoadingText string `yaml:"loadingText"`
+ Description string `yaml:"description"`
}
func (gui *Gui) GetCustomCommandKeybindings() []*Binding {
@@ -230,13 +231,18 @@ func (gui *Gui) GetCustomCommandKeybindings() []*Binding {
contexts = []string{customCommand.Context}
}
+ description := customCommand.Description
+ if description == "" {
+ description = customCommand.Command
+ }
+
bindings = append(bindings, &Binding{
ViewName: viewName,
Contexts: contexts,
Key: gui.getKey(customCommand.Key),
Modifier: gocui.ModNone,
Handler: gui.wrappedHandler(gui.handleCustomCommandKeybinding(customCommand)),
- Description: customCommand.Command,
+ Description: description,
})
}