aboutsummaryrefslogtreecommitdiffstats
path: root/commands/msg/pipe.go
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2023-11-24 16:03:02 +0100
committerRobin Jarry <robin@jarry.cc>2023-12-30 15:42:09 +0100
commitfdd9f7991aa50bd99d21c178a2816fc075eead6b (patch)
tree737207d7dcb5b626f57d59e7b0b247d73a352f28 /commands/msg/pipe.go
parentf98382d1dfc8970d3006fcc2175dd514bf7e07d0 (diff)
downloadaerc-fdd9f7991aa50bd99d21c178a2816fc075eead6b.tar.gz
patch/apply: add apply sub-cmd
Add the :patch apply command to apply a patch set and create a corresponding tag. The tag command argument can be completed based on the subject lines of the selected messages. Add a test for the completion proposal. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
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)