From dc4c36adbfbffd34319ddc007bad437ef802ee72 Mon Sep 17 00:00:00 2001 From: Jeffas Date: Sun, 21 Jul 2019 21:01:51 +0100 Subject: Add new-email trigger This patch sets up the trigger config section of aerc.conf. Each trigger has its own function which is called from the place where it is triggered. Currently only the new-email trigger is implemented. The triggers make use of format strings. For instance, in the new-email trigger this allows the user to select the trigger command and also the information extracted from the command and placed into their command. To actually execute the trigger commands the keypresses are simulated. Further triggers can be implemented in the future. Formatting of the command is moved to a new package. --- commands/commands.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'commands/commands.go') diff --git a/commands/commands.go b/commands/commands.go index 4038fe2..c6f149f 100644 --- a/commands/commands.go +++ b/commands/commands.go @@ -56,11 +56,7 @@ type CommandSource interface { Commands() *Commands } -func (cmds *Commands) ExecuteCommand(aerc *widgets.Aerc, cmd string) error { - args, err := shlex.Split(cmd) - if err != nil { - return err - } +func (cmds *Commands) ExecuteCommand(aerc *widgets.Aerc, args []string) error { if len(args) == 0 { return errors.New("Expected a command.") } -- cgit 1.4.1-2-gfad0