blob: 1d40b90ab90fd8529f997803816d3619b273d74d (
plain) (
blame)
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
|
package msg
import (
"errors"
"fmt"
"strings"
"git.sr.ht/~rjarry/aerc/lib/ui"
)
type Fold struct{}
func init() {
register(Fold{})
}
func (Fold) Aliases() []string {
return []string{"fold", "unfold"}
}
func (Fold) Complete(args []string) []string {
return nil
}
func (Fold) Execute(args []string) error {
if len(args) != 1 {
return fmt.Errorf("Usage: %s", args[0])
}
h := newHelper()
store, err := h.store()
if err != nil {
return err
}
msg := store.Selected()
if msg == nil {
return errors.New("No message selected")
}
switch strings.ToLower(args[0]) {
case "fold":
err = store.Fold(msg.Uid)
case "unfold":
err = store.Unfold(msg.Uid)
}
ui.Invalidate()
return err
}
|