about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBen Cohen <ben@bencohen.net>2019-08-08 14:39:33 -0400
committerDrew DeVault <sir@cmpwn.com>2019-08-12 09:02:24 +0900
commit4d956762746812e8e13a5a08b52801f62833c96c (patch)
treeabc5e39dfe3b90cff31bb870491179164df35175
parentf6df46d31933a8d85a1d6c67de01a118bd1c63e2 (diff)
downloadaerc-4d956762746812e8e13a5a08b52801f62833c96c.tar.gz
Joining the args in cf for folders with spaces
-rw-r--r--commands/account/cf.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/commands/account/cf.go b/commands/account/cf.go
index f078984..f318374 100644
--- a/commands/account/cf.go
+++ b/commands/account/cf.go
@@ -2,6 +2,7 @@ package account
 
 import (
 	"errors"
+	"strings"
 
 	"git.sr.ht/~sircmpwn/aerc/commands"
 	"git.sr.ht/~sircmpwn/aerc/widgets"
@@ -27,7 +28,7 @@ func (_ ChangeFolder) Complete(aerc *widgets.Aerc, args []string) []string {
 }
 
 func (_ ChangeFolder) Execute(aerc *widgets.Aerc, args []string) error {
-	if len(args) != 2 {
+	if len(args) < 2 {
 		return errors.New("Usage: cf <folder>")
 	}
 	acct := aerc.SelectedAccount()
@@ -42,6 +43,9 @@ func (_ ChangeFolder) Execute(aerc *widgets.Aerc, args []string) error {
 			return errors.New("No previous folder to return to")
 		}
 	} else {
+		if len(args) > 2 {
+			args[1] = strings.Join(args[1:], " ")
+		}
 		acct.Directories().Select(args[1])
 	}
 	history[acct.Name()] = previous