aboutsummaryrefslogtreecommitdiffstats
path: root/commands/msg/unsubscribe.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-12-04 23:39:49 +0100
committerRobin Jarry <robin@jarry.cc>2024-01-20 21:56:25 +0100
commit159fb38daf5336758abc425447cf2c2ed51de59a (patch)
treee7be3bea878b12e441332f89d7bc3c63db477c05 /commands/msg/unsubscribe.go
parentd2817371867e94b621de4054b235d53312db8073 (diff)
downloadaerc-159fb38daf5336758abc425447cf2c2ed51de59a.tar.gz
commands: refactor registration
Register all commands with the same function and store them in the same map. Use bit flags to determine in which contexts each command should be available. Remove duplicate commands now that the same command can be exposed in multiple contexts. Refactor API to allow executing commands from other commands without import cycles. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Tested-by: Johannes Thyssen Tishman <johannes@thyssentishman.com>
Diffstat (limited to 'commands/msg/unsubscribe.go')
-rw-r--r--commands/msg/unsubscribe.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/commands/msg/unsubscribe.go b/commands/msg/unsubscribe.go
index c6a0b23f..7ba497b4 100644
--- a/commands/msg/unsubscribe.go
+++ b/commands/msg/unsubscribe.go
@@ -9,6 +9,7 @@ import (
"time"
"git.sr.ht/~rjarry/aerc/app"
+ "git.sr.ht/~rjarry/aerc/commands"
"git.sr.ht/~rjarry/aerc/config"
"git.sr.ht/~rjarry/aerc/lib"
"git.sr.ht/~rjarry/aerc/log"
@@ -23,7 +24,11 @@ type Unsubscribe struct {
}
func init() {
- register(Unsubscribe{})
+ commands.Register(Unsubscribe{})
+}
+
+func (Unsubscribe) Context() commands.CommandContext {
+ return commands.MESSAGE
}
// Aliases returns a list of aliases for the :unsubscribe command