1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-06 23:46:13 +02:00

support custom command loading text

This commit is contained in:
Jesse Duffield 2020-09-27 09:21:20 +10:00
parent 8a59a4404b
commit 7cd17d3a73

View File

@ -72,7 +72,11 @@ func (gui *Gui) handleCustomCommandKeybinding(customCommand CustomCommand) func(
return nil return nil
} }
return gui.WithWaitingStatus(gui.Tr.SLocalize("runningCustomCommandStatus"), func() error { loadingText := customCommand.LoadingText
if loadingText == "" {
loadingText = gui.Tr.SLocalize("runningCustomCommandStatus")
}
return gui.WithWaitingStatus(loadingText, func() error {
gui.OSCommand.PrepareSubProcess(cmdStr) gui.OSCommand.PrepareSubProcess(cmdStr)
if err := gui.OSCommand.RunCommand(cmdStr); err != nil { if err := gui.OSCommand.RunCommand(cmdStr); err != nil {
@ -188,11 +192,12 @@ type CustomCommandPrompt struct {
} }
type CustomCommand struct { type CustomCommand struct {
Key string `yaml:"key"` Key string `yaml:"key"`
Context string `yaml:"context"` Context string `yaml:"context"`
Command string `yaml:"command"` Command string `yaml:"command"`
Subprocess bool `yaml:"subprocess"` Subprocess bool `yaml:"subprocess"`
Prompts []CustomCommandPrompt `yaml:"prompts"` Prompts []CustomCommandPrompt `yaml:"prompts"`
LoadingText string `yaml:"loadingText"`
} }
func (gui *Gui) GetCustomCommandKeybindings() []*Binding { func (gui *Gui) GetCustomCommandKeybindings() []*Binding {