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