aboutsummaryrefslogtreecommitdiff
path: root/commands/account/cf.go
diff options
context:
space:
mode:
authorJeffas <dev@jeffas.io>2019-09-20 17:16:29 +0100
committerDrew DeVault <sir@cmpwn.com>2019-09-20 15:06:34 -0400
commit39307a6fa7e96641b822ed0a9acb75021dcf7fe9 (patch)
tree683aec09eb86e2077148a53429681aa39776449b /commands/account/cf.go
parent3ec9fd216d9e3b38d1d5abb5fba24199185f7054 (diff)
Make commands join args with spaces
This patch ensures the following commands join their arguments with spaces to make it easier to interact with: - cf - mkdir - cd - attach - detach - ct - copy - move - save
Diffstat (limited to 'commands/account/cf.go')
-rw-r--r--commands/account/cf.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/commands/account/cf.go b/commands/account/cf.go
index cbef308..65b8810 100644
--- a/commands/account/cf.go
+++ b/commands/account/cf.go
@@ -28,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) == 1 {
return errors.New("Usage: cf <folder>")
}
acct := aerc.SelectedAccount()
@@ -36,17 +36,15 @@ func (ChangeFolder) Execute(aerc *widgets.Aerc, args []string) error {
return errors.New("No account selected")
}
previous := acct.Directories().Selected()
- if args[1] == "-" {
+ joinedArgs := strings.Join(args[1:], " ")
+ if joinedArgs == "-" {
if dir, ok := history[acct.Name()]; ok {
acct.Directories().Select(dir)
} else {
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])
+ acct.Directories().Select(joinedArgs)
}
history[acct.Name()] = previous