mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-03-05 15:15:49 +02:00
Add showOutput option to custom commands (#1163)
This commit is contained in:
parent
367b0d3318
commit
e1f41b653c
@ -310,6 +310,7 @@ type CustomCommand struct {
|
||||
LoadingText string `yaml:"loadingText"`
|
||||
Description string `yaml:"description"`
|
||||
Stream bool `yaml:"stream"`
|
||||
ShowOutput bool `yaml:"showOutput"`
|
||||
}
|
||||
|
||||
type CustomCommandPrompt struct {
|
||||
|
@ -187,10 +187,13 @@ func (self *HandlerCreator) finalHandler(customCommand config.CustomCommand, ses
|
||||
if customCommand.Stream {
|
||||
cmdObj.StreamOutput()
|
||||
}
|
||||
err := cmdObj.Run()
|
||||
output, err := cmdObj.RunWithOutput()
|
||||
if err != nil {
|
||||
return self.c.Error(err)
|
||||
}
|
||||
if customCommand.ShowOutput {
|
||||
return self.c.Alert(cmdStr, output)
|
||||
}
|
||||
return self.c.Refresh(types.RefreshOptions{})
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user