aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--commands/msg/pipe.go3
-rw-r--r--commands/util.go6
-rw-r--r--doc/aerc.1.scd2
3 files changed, 9 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)
diff --git a/doc/aerc.1.scd b/doc/aerc.1.scd
index 66e86fdd..1351f5b6 100644
--- a/doc/aerc.1.scd
+++ b/doc/aerc.1.scd
@@ -403,6 +403,8 @@ message list, the message in the message viewer, etc).
*-b*: Run the command in the background instead of opening a terminal tab
+ *-s*: Silently close the terminal tab after the command is completed
+
*-m*: Pipe the full message
*-p*: Pipe just the selected message part, if applicable