summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--widgets/account.go14
-rw-r--r--widgets/aerc.go22
2 files changed, 24 insertions, 12 deletions
diff --git a/widgets/account.go b/widgets/account.go
index 8662c0c..54eb9e9 100644
--- a/widgets/account.go
+++ b/widgets/account.go
@@ -20,13 +20,14 @@ type AccountView struct {
 	logger       *log.Logger
 	interactive  ui.Interactive
 	onInvalidate func(d ui.Drawable)
+	runCmd       func(cmd string) error
 	statusline   *StatusLine
 	statusbar    *ui.Stack
 	worker       *types.Worker
 }
 
-func NewAccountView(
-	conf *config.AccountConfig, logger *log.Logger) *AccountView {
+func NewAccountView(conf *config.AccountConfig,
+	logger *log.Logger, runCmd func(cmd string) error) *AccountView {
 
 	statusbar := ui.NewStack()
 	statusline := NewStatusLine()
@@ -63,6 +64,7 @@ func NewAccountView(
 		dirlist:    dirlist,
 		grid:       grid,
 		logger:     logger,
+		runCmd:     runCmd,
 		statusline: statusline,
 		statusbar:  statusbar,
 		worker:     worker,
@@ -106,8 +108,12 @@ func (acct *AccountView) Event(event tcell.Event) bool {
 	case *tcell.EventKey:
 		if event.Rune() == ':' {
 			exline := NewExLine(func(command string) {
-				acct.statusline.Push(
-					fmt.Sprintf("TODO: execute %s", command), 3*time.Second)
+				err := acct.runCmd(command)
+				if err != nil {
+					acct.statusline.Push(
+						fmt.Sprintf("Error: %v", err), 3*time.Second).
+						Color(tcell.ColorRed, tcell.ColorDefault)
+				}
 				acct.statusbar.Pop()
 				acct.interactive = nil
 			}, func() {
diff --git a/widgets/aerc.go b/widgets/aerc.go
index cd4b773..9444c9f 100644
--- a/widgets/aerc.go
+++ b/widgets/aerc.go
@@ -1,6 +1,7 @@
 package widgets
 
 import (
+	"fmt"
 	"log"
 
 	"github.com/gdamore/tcell"
@@ -33,19 +34,19 @@ func NewAerc(conf *config.AercConfig, logger *log.Logger) *Aerc {
 	mainGrid.AddChild(tabs.TabStrip).At(0, 1)
 	mainGrid.AddChild(tabs.TabContent).At(1, 0).Span(1, 2)
 
-	accts := make(map[string]*AccountView)
+	aerc := &Aerc{
+		accounts: make(map[string]*AccountView),
+		grid:     mainGrid,
+		tabs:     tabs,
+	}
 
 	for _, acct := range conf.Accounts {
-		view := NewAccountView(&acct, logger)
-		accts[acct.Name] = view
+		view := NewAccountView(&acct, logger, aerc.RunCommand)
+		aerc.accounts[acct.Name] = view
 		tabs.Add(view, acct.Name)
 	}
 
-	return &Aerc{
-		accounts: accts,
-		grid:     mainGrid,
-		tabs:     tabs,
-	}
+	return aerc
 }
 
 func (aerc *Aerc) OnInvalidate(onInvalidate func(d libui.Drawable)) {
@@ -66,3 +67,8 @@ func (aerc *Aerc) Event(event tcell.Event) bool {
 	acct, _ := aerc.tabs.Tabs[aerc.tabs.Selected].Content.(*AccountView)
 	return acct.Event(event)
 }
+
+func (aerc *Aerc) RunCommand(cmd string) error {
+	// TODO
+	return fmt.Errorf("TODO: execute '%s'", cmd)
+}
com> 2009-06-12 06:44:28 +0200 committer hut <hut@lavabit.com> 2009-06-12 06:44:28 +0200 detached entry from directory into a seperate file' href='/akspecs/ranger/commit/code/directory.rb?id=704ea6ba9be080f0dec9ffc06042cc4750ffd711'>704ea6ba ^
7d21f3d5 ^
01104f4a ^
e3da2766 ^
34bfb32e ^
7d21f3d5 ^
34bfb32e ^
a0de7f95 ^
704ea6ba ^
7d21f3d5 ^
704ea6ba ^

7d21f3d5 ^

34bfb32e ^

7d21f3d5 ^


34bfb32e ^

a0de7f95 ^
6f78d086 ^
a0de7f95 ^

704ea6ba ^




df465458 ^
a0de7f95 ^

adfea091

a0de7f95 ^




adfea091
a0de7f95 ^
adfea091



a0de7f95 ^


































34bfb32e ^





adfea091
34bfb32e ^
adfea091
34bfb32e ^
adfea091





e07a7764 ^



775207db ^
e07a7764 ^






adfea091









f8634dd6 ^
a93af1cd ^
adfea091




34bfb32e ^




adfea091
a0de7f95 ^
df465458 ^
adfea091

34bfb32e ^

01104f4a ^
34bfb32e ^

















adfea091
34bfb32e ^


adfea091
6f78d086 ^
34bfb32e ^
adfea091
34bfb32e ^
622ff1dc ^
34bfb32e ^


a0de7f95 ^
34bfb32e ^

29fe5ed4 ^
a0de7f95 ^



34bfb32e ^
adfea091
6f78d086 ^





34bfb32e ^
01104f4a ^
a0de7f95 ^



34bfb32e ^





2a415f90 ^
34bfb32e ^
adfea091

34bfb32e ^

6f78d086 ^
2a415f90 ^
f5590f43 ^
34bfb32e ^








2a415f90 ^


34bfb32e ^
c71a21f6 ^



adfea091

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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255