aboutsummaryrefslogtreecommitdiff
path: root/commands/msg/modify-labels.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/msg/modify-labels.go')
-rw-r--r--commands/msg/modify-labels.go14
1 files changed, 5 insertions, 9 deletions
diff --git a/commands/msg/modify-labels.go b/commands/msg/modify-labels.go
index 02eed520..72915e65 100644
--- a/commands/msg/modify-labels.go
+++ b/commands/msg/modify-labels.go
@@ -1,7 +1,6 @@
package msg
import (
- "errors"
"time"
"git.sr.ht/~rjarry/aerc/commands"
@@ -9,7 +8,9 @@ import (
"git.sr.ht/~rjarry/aerc/worker/types"
)
-type ModifyLabels struct{}
+type ModifyLabels struct {
+ Labels []string `opt:"..." metavar:"[+-]LABEL"`
+}
func init() {
register(ModifyLabels{})
@@ -23,12 +24,7 @@ func (ModifyLabels) Complete(aerc *widgets.Aerc, args []string) []string {
return commands.GetLabels(aerc, args)
}
-func (ModifyLabels) Execute(aerc *widgets.Aerc, args []string) error {
- changes := args[1:]
- if len(changes) == 0 {
- return errors.New("Usage: modify-labels <[+-]label> ...")
- }
-
+func (m ModifyLabels) Execute(aerc *widgets.Aerc, args []string) error {
h := newHelper(aerc)
store, err := h.store()
if err != nil {
@@ -40,7 +36,7 @@ func (ModifyLabels) Execute(aerc *widgets.Aerc, args []string) error {
}
var add, remove []string
- for _, l := range changes {
+ for _, l := range m.Labels {
switch l[0] {
case '+':
add = append(add, l[1:])