mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-09 09:22:48 +03:00
support setting description in custom command
This commit is contained in:
@@ -10,6 +10,7 @@ customCommands:
|
|||||||
- key: 'a'
|
- key: 'a'
|
||||||
command: "git {{if .SelectedFile.HasUnstagedChanges}} add {{else}} reset {{end}} {{.SelectedFile.Name}}"
|
command: "git {{if .SelectedFile.HasUnstagedChanges}} add {{else}} reset {{end}} {{.SelectedFile.Name}}"
|
||||||
context: 'files'
|
context: 'files'
|
||||||
|
description: 'toggle file staged'
|
||||||
- key: 'C'
|
- key: 'C'
|
||||||
command: "git commit"
|
command: "git commit"
|
||||||
context: 'global'
|
context: 'global'
|
||||||
@@ -53,6 +54,7 @@ For a given custom command, here are the allowed fields:
|
|||||||
| subprocess | whether you want the command to run in a subprocess (necessary if you want to view the output of the command or provide user input) | no |
|
| subprocess | whether you want the command to run in a subprocess (necessary if you want to view the output of the command or provide user input) | no |
|
||||||
| prompts | a list of prompts that will request user input before running the final command | no |
|
| prompts | a list of prompts that will request user input before running the final command | no |
|
||||||
| loadingText | text to display while waiting for command to finish | no |
|
| loadingText | text to display while waiting for command to finish | no |
|
||||||
|
| description | text to display in the keybindings menu that appears when you press 'x' | no |
|
||||||
|
|
||||||
### Contexts
|
### Contexts
|
||||||
|
|
||||||
|
@@ -199,6 +199,7 @@ type CustomCommand struct {
|
|||||||
Subprocess bool `yaml:"subprocess"`
|
Subprocess bool `yaml:"subprocess"`
|
||||||
Prompts []CustomCommandPrompt `yaml:"prompts"`
|
Prompts []CustomCommandPrompt `yaml:"prompts"`
|
||||||
LoadingText string `yaml:"loadingText"`
|
LoadingText string `yaml:"loadingText"`
|
||||||
|
Description string `yaml:"description"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) GetCustomCommandKeybindings() []*Binding {
|
func (gui *Gui) GetCustomCommandKeybindings() []*Binding {
|
||||||
@@ -230,13 +231,18 @@ func (gui *Gui) GetCustomCommandKeybindings() []*Binding {
|
|||||||
contexts = []string{customCommand.Context}
|
contexts = []string{customCommand.Context}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
description := customCommand.Description
|
||||||
|
if description == "" {
|
||||||
|
description = customCommand.Command
|
||||||
|
}
|
||||||
|
|
||||||
bindings = append(bindings, &Binding{
|
bindings = append(bindings, &Binding{
|
||||||
ViewName: viewName,
|
ViewName: viewName,
|
||||||
Contexts: contexts,
|
Contexts: contexts,
|
||||||
Key: gui.getKey(customCommand.Key),
|
Key: gui.getKey(customCommand.Key),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.wrappedHandler(gui.handleCustomCommandKeybinding(customCommand)),
|
Handler: gui.wrappedHandler(gui.handleCustomCommandKeybinding(customCommand)),
|
||||||
Description: customCommand.Command,
|
Description: description,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user