summary refs log tree commit diff stats
path: root/aerc.go
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-03-15 20:32:09 -0400
committerDrew DeVault <sir@cmpwn.com>2019-03-15 20:32:09 -0400
commitf406bf5a3bb953426a00f2feac1f2863a29ab269 (patch)
tree70b1c238bae590b7f1814840ba303faa1532d8cb /aerc.go
parent22f453f56a18da91c987baa3a47fa91f666d8b7a (diff)
downloadaerc-f406bf5a3bb953426a00f2feac1f2863a29ab269.tar.gz
Add :quit command
Diffstat (limited to 'aerc.go')
-rw-r--r--aerc.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/aerc.go b/aerc.go
index 1e2f884..0da80e9 100644
--- a/aerc.go
+++ b/aerc.go
@@ -33,12 +33,20 @@ func main() {
 		panic(err)
 	}
 
-	var aerc *widgets.Aerc
+	var (
+		aerc *widgets.Aerc
+		ui   *libui.UI
+	)
 	aerc = widgets.NewAerc(conf, logger, func(cmd string) error {
-		return commands.ExecuteCommand(aerc, cmd)
+		err = commands.ExecuteCommand(aerc, cmd)
+		if _, ok := err.(commands.ErrorExit); ok {
+			ui.Exit = true
+			return nil
+		}
+		return err
 	})
 
-	ui, err := libui.Initialize(conf, aerc)
+	ui, err = libui.Initialize(conf, aerc)
 	if err != nil {
 		panic(err)
 	}