about summary refs log tree commit diff stats
path: root/commands/account
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
parent3ec9fd216d9e3b38d1d5abb5fba24199185f7054 (diff)
downloadaerc-39307a6fa7e96641b822ed0a9acb75021dcf7fe9.tar.gz
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')
-rw-r--r--commands/account/cf.go10
-rw-r--r--commands/account/mkdir.go5
2 files changed, 7 insertions, 8 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
 
diff --git a/commands/account/mkdir.go b/commands/account/mkdir.go
index d42928e..bb7e38a 100644
--- a/commands/account/mkdir.go
+++ b/commands/account/mkdir.go
@@ -2,6 +2,7 @@ package account
 
 import (
 	"errors"
+	"strings"
 	"time"
 
 	"github.com/gdamore/tcell"
@@ -25,14 +26,14 @@ func (MakeDir) Complete(aerc *widgets.Aerc, args []string) []string {
 }
 
 func (MakeDir) Execute(aerc *widgets.Aerc, args []string) error {
-	if len(args) != 2 {
+	if len(args) == 0 {
 		return errors.New("Usage: :mkdir <name>")
 	}
 	acct := aerc.SelectedAccount()
 	if acct == nil {
 		return errors.New("No account selected")
 	}
-	name := args[1]
+	name := strings.Join(args[1:], " ")
 	acct.Worker().PostAction(&types.CreateDirectory{
 		Directory: name,
 	}, func(msg types.WorkerMessage) {
019-07-14 09:42:36 -0700 .' href='/akkartik/mu/commit/html/subx/076zero-out.subx.html?h=main&id=ce2c1efc41470764126e9a1a7f4e0cfec4213587'>ce2c1efc ^
b1635a5c ^
33352536 ^

ce2c1efc ^
33352536 ^





2104d1a7 ^
33352536 ^


ce2c1efc ^

33352536 ^
6070c23e ^
ce2c1efc ^
33352536 ^
ce2c1efc ^
33352536 ^
ce2c1efc ^
33352536 ^
4a4a392d ^
ce2c1efc ^

33352536 ^



b1635a5c ^
33352536 ^

ce2c1efc ^


b1635a5c ^
33352536 ^


ce2c1efc ^
33352536 ^

ce2c1efc ^

33352536 ^
ce2c1efc ^
4a4a392d ^
ce2c1efc ^
33352536 ^
ce2c1efc ^
33352536 ^
ce2c1efc ^


33352536 ^
ce2c1efc ^


33352536 ^
b1635a5c ^
33352536 ^

ce2c1efc ^






1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147