diff options
Diffstat (limited to 'commands')
-rw-r--r-- | commands/msg/pipe.go | 3 | ||||
-rw-r--r-- | commands/util.go | 6 |
2 files changed, 7 insertions, 2 deletions
diff --git a/commands/msg/pipe.go b/commands/msg/pipe.go index 7135df01..980ba38d 100644 --- a/commands/msg/pipe.go +++ b/commands/msg/pipe.go @@ -19,6 +19,7 @@ import ( type Pipe struct { Background bool `opt:"-b"` + Silent bool `opt:"-s"` Full bool `opt:"-m"` Part bool `opt:"-p"` Command string `opt:"..."` @@ -60,7 +61,7 @@ func (p Pipe) Run(cb func()) error { doTerm := func(reader io.Reader, name string) { cmd := []string{"sh", "-c", p.Command} - term, err := commands.QuickTerm(cmd, reader) + term, err := commands.QuickTerm(cmd, reader, p.Silent) if err != nil { app.PushError(err.Error()) return diff --git a/commands/util.go b/commands/util.go index 39c9dafc..b6a458fd 100644 --- a/commands/util.go +++ b/commands/util.go @@ -23,7 +23,7 @@ import ( ) // QuickTerm is an ephemeral terminal for running a single command and quitting. -func QuickTerm(args []string, stdin io.Reader) (*app.Terminal, error) { +func QuickTerm(args []string, stdin io.Reader, silent bool) (*app.Terminal, error) { cmd := exec.Command(args[0], args[1:]...) pipe, err := cmd.StdinPipe() if err != nil { @@ -40,6 +40,10 @@ func QuickTerm(args []string, stdin io.Reader) (*app.Terminal, error) { app.PushError(err.Error()) // remove the tab on error, otherwise it gets stuck app.RemoveTab(term, false) + return + } + if silent { + app.RemoveTab(term, true) } else { app.PushStatus("Process complete, press any key to close.", 10*time.Second) |