aboutsummaryrefslogtreecommitdiff
path: root/commands/exec.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/exec.go')
-rw-r--r--commands/exec.go13
1 files changed, 5 insertions, 8 deletions
diff --git a/commands/exec.go b/commands/exec.go
index 37274116..ff94c658 100644
--- a/commands/exec.go
+++ b/commands/exec.go
@@ -1,7 +1,6 @@
package commands
import (
- "errors"
"fmt"
"os"
"os/exec"
@@ -11,7 +10,9 @@ import (
"git.sr.ht/~rjarry/aerc/widgets"
)
-type ExecCmd struct{}
+type ExecCmd struct {
+ Args []string `opt:"..."`
+}
func init() {
register(ExecCmd{})
@@ -25,12 +26,8 @@ func (ExecCmd) Complete(aerc *widgets.Aerc, args []string) []string {
return nil
}
-func (ExecCmd) Execute(aerc *widgets.Aerc, args []string) error {
- if len(args) < 2 {
- return errors.New("Usage: exec [cmd...]")
- }
-
- cmd := exec.Command(args[1], args[2:]...)
+func (e ExecCmd) Execute(aerc *widgets.Aerc, args []string) error {
+ cmd := exec.Command(e.Args[0], e.Args[1:]...)
env := os.Environ()
switch view := aerc.SelectedTabContent().(type) {