mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 04:15:48 +02:00
Combine customCommand's subprocess, stream, and showOutput fields into a single output enum
This commit is contained in:
parent
5f4be3bfb7
commit
a9f9dee30d
9 changed files with 187 additions and 43 deletions
|
@ -262,7 +262,7 @@ func (self *HandlerCreator) finalHandler(customCommand config.CustomCommand, ses
|
|||
|
||||
cmdObj := self.c.OS().Cmd.NewShell(cmdStr, self.c.UserConfig().OS.ShellFunctionsFile)
|
||||
|
||||
if customCommand.Subprocess != nil && *customCommand.Subprocess {
|
||||
if customCommand.Output == "terminal" {
|
||||
return self.c.RunSubprocessAndRefresh(cmdObj)
|
||||
}
|
||||
|
||||
|
@ -274,9 +274,12 @@ func (self *HandlerCreator) finalHandler(customCommand config.CustomCommand, ses
|
|||
return self.c.WithWaitingStatus(loadingText, func(gocui.Task) error {
|
||||
self.c.LogAction(self.c.Tr.Actions.CustomCommand)
|
||||
|
||||
if customCommand.Stream != nil && *customCommand.Stream {
|
||||
if customCommand.Output == "log" || customCommand.Output == "logWithPty" {
|
||||
cmdObj.StreamOutput()
|
||||
}
|
||||
if customCommand.Output == "logWithPty" {
|
||||
cmdObj.UsePty()
|
||||
}
|
||||
output, err := cmdObj.RunWithOutput()
|
||||
|
||||
if refreshErr := self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC}); err != nil {
|
||||
|
@ -291,7 +294,7 @@ func (self *HandlerCreator) finalHandler(customCommand config.CustomCommand, ses
|
|||
return err
|
||||
}
|
||||
|
||||
if customCommand.ShowOutput != nil && *customCommand.ShowOutput {
|
||||
if customCommand.Output == "popup" {
|
||||
if strings.TrimSpace(output) == "" {
|
||||
output = self.c.Tr.EmptyOutput
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue