1
0
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:
sportshead 2022-07-28 18:35:58 +08:00
parent 367b0d3318
commit e1f41b653c
2 changed files with 5 additions and 1 deletions

View File

@ -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 {

View File

@ -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{})
})
}