aboutsummaryrefslogtreecommitdiffstats
path: root/commands/msg/pipe.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/msg/pipe.go')
-rw-r--r--commands/msg/pipe.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/commands/msg/pipe.go b/commands/msg/pipe.go
index b32d7159..ee5cd965 100644
--- a/commands/msg/pipe.go
+++ b/commands/msg/pipe.go
@@ -33,6 +33,10 @@ func (Pipe) Aliases() []string {
}
func (p Pipe) Execute(args []string) error {
+ return p.Run(nil)
+}
+
+func (p Pipe) Run(cb func()) error {
if p.Full && p.Part {
return errors.New("-m and -p are mutually exclusive")
}
@@ -57,6 +61,15 @@ func (p Pipe) Execute(args []string) error {
app.PushError(err.Error())
return
}
+ if cb != nil {
+ last := term.OnClose
+ term.OnClose = func(err error) {
+ if last != nil {
+ last(err)
+ }
+ cb()
+ }
+ }
app.NewTab(term, name)
}
@@ -89,6 +102,9 @@ func (p Pipe) Execute(args []string) error {
ecmd.ProcessState.ExitCode()), 10*time.Second)
}
}
+ if cb != nil {
+ cb()
+ }
}
app.PushStatus("Fetching messages ...", 10*time.Second)