about summary refs log tree commit diff stats
path: root/commands
diff options
context:
space:
mode:
Diffstat (limited to 'commands')
-rw-r--r--commands/exec.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/commands/exec.go b/commands/exec.go
index e15afbe..771c528 100644
--- a/commands/exec.go
+++ b/commands/exec.go
@@ -3,6 +3,7 @@ package commands
 import (
 	"errors"
 	"fmt"
+	"os"
 	"os/exec"
 	"time"
 
@@ -29,7 +30,22 @@ 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:]...)
+	env := os.Environ()
+
+	switch view := aerc.SelectedTab().(type) {
+	case *widgets.AccountView:
+		env = append(env, fmt.Sprintf("account=%s", view.AccountConfig().Name))
+		env = append(env, fmt.Sprintf("folder=%s", view.Directories().Selected()))
+	case *widgets.MessageViewer:
+		acct := view.SelectedAccount()
+		env = append(env, fmt.Sprintf("account=%s", acct.AccountConfig().Name))
+		env = append(env, fmt.Sprintf("folder=%s", acct.Directories().Selected()))
+	}
+
+	cmd.Env = env
+
 	go func() {
 		err := cmd.Run()
 		if err != nil {
*/ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
void cmd_connect_shows_message_when_disconnecting(void **state);
void cmd_connect_shows_message_when_connecting(void **state);
void cmd_connect_shows_message_when_connected(void **state);
void cmd_connect_shows_message_when_undefined(void **state);
void cmd_connect_when_no_account(void **state);
void cmd_connect_with_altdomain_when_provided(void **state);
void cmd_connect_fail_message(void **state);
void cmd_connect_lowercases_argument(void **state);
void cmd_connect_asks_password_when_not_in_account(void **state);
void cmd_connect_shows_message_when_connecting_with_account(void **state);
void cmd_connect_connects_with_account(void **state);
void cmd_connect_shows_usage_when_no_server_value(void **state);
void cmd_connect_shows_usage_when_server_no_port_value(void **state);
void cmd_connect_shows_usage_when_no_port_value(void **state);
void cmd_connect_shows_usage_when_port_no_server_value(void **state);
void cmd_connect_shows_message_when_port_0(void **state);
void cmd_connect_shows_message_when_port_minus1(void **state);
void cmd_connect_shows_message_when_port_65536(void **state);
void cmd_connect_shows_message_when_port_contains_chars(void **state);
void cmd_connect_with_server_when_provided(void **state);
void cmd_connect_with_port_when_provided(void **state);
void cmd_connect_with_server_and_port_when_provided(void **state);
void cmd_connect_shows_usage_when_server_provided_twice(void **state);
void cmd_connect_shows_usage_when_port_provided_twice(void **state);
void cmd_connect_shows_usage_when_invalid_first_property(void **state);
void cmd_connect_shows_usage_when_invalid_second_property(void **state);