about summary refs log tree commit diff stats
path: root/commands/msg
diff options
context:
space:
mode:
Diffstat (limited to 'commands/msg')
-rw-r--r--commands/msg/archive.go14
-rw-r--r--commands/msg/copy.go15
-rw-r--r--commands/msg/delete.go15
-rw-r--r--commands/msg/move.go15
-rw-r--r--commands/msg/msg.go4
-rw-r--r--commands/msg/read.go15
-rw-r--r--commands/msg/reply.go15
7 files changed, 74 insertions, 19 deletions
diff --git a/commands/msg/archive.go b/commands/msg/archive.go
index 4fe7330..40fb48b 100644
--- a/commands/msg/archive.go
+++ b/commands/msg/archive.go
@@ -18,11 +18,21 @@ const (
 	ARCHIVE_MONTH = "month"
 )
 
+type Archive struct{}
+
 func init() {
-	register("archive", Archive)
+	register(Archive{})
+}
+
+func (_ Archive) Aliases() []string {
+	return []string{"archive"}
+}
+
+func (_ Archive) Complete(aerc *widgets.Aerc, args []string) []string {
+	return nil
 }
 
-func Archive(aerc *widgets.Aerc, args []string) error {
+func (_ Archive) Execute(aerc *widgets.Aerc, args []string) error {
 	if len(args) != 2 {
 		return errors.New("Usage: archive <flat|year|month>")
 	}
diff --git a/commands/msg/copy.go b/commands/msg/copy.go
index 0735e98..4d65d24 100644
--- a/commands/msg/copy.go
+++ b/commands/msg/copy.go
@@ -11,12 +11,21 @@ import (
 	"git.sr.ht/~sircmpwn/aerc/worker/types"
 )
 
+type Copy struct{}
+
 func init() {
-	register("cp", Copy)
-	register("copy", Copy)
+	register(Copy{})
+}
+
+func (_ Copy) Aliases() []string {
+	return []string{"copy"}
+}
+
+func (_ Copy) Complete(aerc *widgets.Aerc, args []string) []string {
+	return nil
 }
 
-func Copy(aerc *widgets.Aerc, args []string) error {
+func (_ Copy) Execute(aerc *widgets.Aerc, args []string) error {
 	opts, optind, err := getopt.Getopts(args, "p")
 	if err != nil {
 		return err
diff --git a/commands/msg/delete.go b/commands/msg/delete.go
index ee3dd29..5a72fc9 100644
--- a/commands/msg/delete.go
+++ b/commands/msg/delete.go
@@ -10,12 +10,21 @@ import (
 	"git.sr.ht/~sircmpwn/aerc/worker/types"
 )
 
+type Delete struct{}
+
 func init() {
-	register("delete", DeleteMessage)
-	register("delete-message", DeleteMessage)
+	register(Delete{})
+}
+
+func (_ Delete) Aliases() []string {
+	return []string{"delete", "delete-message"}
+}
+
+func (_ Delete) Complete(aerc *widgets.Aerc, args []string) []string {
+	return nil
 }
 
-func DeleteMessage(aerc *widgets.Aerc, args []string) error {
+func (_ Delete) Execute(aerc *widgets.Aerc, args []string) error {
 	if len(args) != 1 {
 		return errors.New("Usage: :delete")
 	}
diff --git a/commands/msg/move.go b/commands/msg/move.go
index 2367076..45199b6 100644
--- a/commands/msg/move.go
+++ b/commands/msg/move.go
@@ -11,12 +11,21 @@ import (
 	"git.sr.ht/~sircmpwn/aerc/worker/types"
 )
 
+type Move struct{}
+
 func init() {
-	register("mv", Move)
-	register("move", Move)
+	register(Move{})
+}
+
+func (_ Move) Aliases() []string {
+	return []string{"mv", "move"}
+}
+
+func (_ Move) Complete(aerc *widgets.Aerc, args []string) []string {
+	return nil
 }
 
-func Move(aerc *widgets.Aerc, args []string) error {
+func (_ Move) Execute(aerc *widgets.Aerc, args []string) error {
 	opts, optind, err := getopt.Getopts(args, "p")
 	if err != nil {
 		return err
diff --git a/commands/msg/msg.go b/commands/msg/msg.go
index 73755aa..ecf2102 100644
--- a/commands/msg/msg.go
+++ b/commands/msg/msg.go
@@ -8,9 +8,9 @@ var (
 	MessageCommands *commands.Commands
 )
 
-func register(name string, cmd commands.AercCommand) {
+func register(cmd commands.Command) {
 	if MessageCommands == nil {
 		MessageCommands = commands.NewCommands()
 	}
-	MessageCommands.Register(name, cmd)
+	MessageCommands.Register(cmd)
 }
diff --git a/commands/msg/read.go b/commands/msg/read.go
index 9844797..db463f1 100644
--- a/commands/msg/read.go
+++ b/commands/msg/read.go
@@ -10,12 +10,21 @@ import (
 	"git.sr.ht/~sircmpwn/aerc/worker/types"
 )
 
+type Read struct{}
+
 func init() {
-	register("read", Read)
-	register("unread", Read)
+	register(Read{})
+}
+
+func (_ Read) Aliases() []string {
+	return []string{"read", "unread"}
+}
+
+func (_ Read) Complete(aerc *widgets.Aerc, args []string) []string {
+	return nil
 }
 
-func Read(aerc *widgets.Aerc, args []string) error {
+func (_ Read) Execute(aerc *widgets.Aerc, args []string) error {
 	if len(args) != 1 {
 		return errors.New("Usage: " + args[0])
 	}
diff --git a/commands/msg/reply.go b/commands/msg/reply.go
index 51f6584..7a64d21 100644
--- a/commands/msg/reply.go
+++ b/commands/msg/reply.go
@@ -18,12 +18,21 @@ import (
 	"git.sr.ht/~sircmpwn/aerc/widgets"
 )
 
+type reply struct{}
+
 func init() {
-	register("reply", Reply)
-	register("forward", Reply)
+	register(reply{})
+}
+
+func (_ reply) Aliases() []string {
+	return []string{"reply", "forward"}
+}
+
+func (_ reply) Complete(aerc *widgets.Aerc, args []string) []string {
+	return nil
 }
 
-func Reply(aerc *widgets.Aerc, args []string) error {
+func (_ reply) Execute(aerc *widgets.Aerc, args []string) error {
 	opts, optind, err := getopt.Getopts(args, "aq")
 	if err != nil {
 		return err