aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2024-02-28 23:55:20 +0100
committerRobin Jarry <robin@jarry.cc>2024-03-04 22:30:14 +0100
commit2453375721832304b512380e6610de2c3d765bd5 (patch)
tree25960ef9ebb75ecb9c8b53fab4d2eea958c9e57f
parent963633eb83dc19089236ac78ba9d823e7e2a6df9 (diff)
downloadaerc-2453375721832304b512380e6610de2c3d765bd5.tar.gz
commands: rename confusing constants
There is an overlap between ACCOUNT and MESSAGE. Rename ACCOUNT to MESSAGE_LIST and use MESSAGE_LIST|MESSAGE_VIEWER instead of MESSAGE. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Tim Culverhouse <tim@timculverhouse.com>
-rw-r--r--commands/account/align.go2
-rw-r--r--commands/account/cf.go2
-rw-r--r--commands/account/check-mail.go2
-rw-r--r--commands/account/clear.go2
-rw-r--r--commands/account/compose.go2
-rw-r--r--commands/account/connection.go2
-rw-r--r--commands/account/expand-folder.go2
-rw-r--r--commands/account/export-mbox.go2
-rw-r--r--commands/account/import-mbox.go2
-rw-r--r--commands/account/mkdir.go2
-rw-r--r--commands/account/next-folder.go2
-rw-r--r--commands/account/next-result.go2
-rw-r--r--commands/account/next.go2
-rw-r--r--commands/account/query.go2
-rw-r--r--commands/account/recover.go2
-rw-r--r--commands/account/rmdir.go2
-rw-r--r--commands/account/search.go2
-rw-r--r--commands/account/select.go2
-rw-r--r--commands/account/sort.go2
-rw-r--r--commands/account/split.go2
-rw-r--r--commands/account/view.go2
-rw-r--r--commands/commands.go12
-rw-r--r--commands/msg/archive.go2
-rw-r--r--commands/msg/bounce.go2
-rw-r--r--commands/msg/copy.go2
-rw-r--r--commands/msg/delete.go2
-rw-r--r--commands/msg/envelope.go2
-rw-r--r--commands/msg/fold.go2
-rw-r--r--commands/msg/forward.go2
-rw-r--r--commands/msg/invite.go2
-rw-r--r--commands/msg/mark.go2
-rw-r--r--commands/msg/modify-labels.go2
-rw-r--r--commands/msg/move.go2
-rw-r--r--commands/msg/pipe.go2
-rw-r--r--commands/msg/read.go2
-rw-r--r--commands/msg/recall.go2
-rw-r--r--commands/msg/reply.go2
-rw-r--r--commands/msg/toggle-thread-context.go2
-rw-r--r--commands/msg/toggle-threads.go2
-rw-r--r--commands/msg/unsubscribe.go2
-rw-r--r--commands/patch/apply.go2
41 files changed, 45 insertions, 47 deletions
diff --git a/commands/account/align.go b/commands/account/align.go
index 7f835b71..e4c1379a 100644
--- a/commands/account/align.go
+++ b/commands/account/align.go
@@ -37,7 +37,7 @@ func (a *Align) CompletePos(arg string) []string {
}
func (Align) Context() commands.CommandContext {
- return commands.ACCOUNT
+ return commands.MESSAGE_LIST
}
func (Align) Aliases() []string {
diff --git a/commands/account/cf.go b/commands/account/cf.go
index 0f818006..e96ab2d6 100644
--- a/commands/account/cf.go
+++ b/commands/account/cf.go
@@ -27,7 +27,7 @@ func init() {
}
func (ChangeFolder) Context() commands.CommandContext {
- return commands.ACCOUNT
+ return commands.MESSAGE_LIST
}
func (ChangeFolder) Aliases() []string {
diff --git a/commands/account/check-mail.go b/commands/account/check-mail.go
index bc41a935..d82fa042 100644
--- a/commands/account/check-mail.go
+++ b/commands/account/check-mail.go
@@ -14,7 +14,7 @@ func init() {
}
func (CheckMail) Context() commands.CommandContext {
- return commands.ACCOUNT
+ return commands.MESSAGE_LIST
}
func (CheckMail) Aliases() []string {
diff --git a/commands/account/clear.go b/commands/account/clear.go
index 46335431..1c13ddf5 100644
--- a/commands/account/clear.go
+++ b/commands/account/clear.go
@@ -17,7 +17,7 @@ func init() {
}
func (Clear) Context() commands.CommandContext {
- return commands.ACCOUNT
+ return commands.MESSAGE_LIST
}
func (Clear) Aliases() []string {
diff --git a/commands/account/compose.go b/commands/account/compose.go
index e45f77c3..c9e36379 100644
--- a/commands/account/compose.go
+++ b/commands/account/compose.go
@@ -28,7 +28,7 @@ func init() {
}
func (Compose) Context() commands.CommandContext {
- return commands.ACCOUNT
+ return commands.MESSAGE_LIST
}
func (c *Compose) ParseHeader(arg string) error {
diff --git a/commands/account/connection.go b/commands/account/connection.go
index 75171cf4..126c79f1 100644
--- a/commands/account/connection.go
+++ b/commands/account/connection.go
@@ -16,7 +16,7 @@ func init() {
}
func (Connection) Context() commands.CommandContext {
- return commands.ACCOUNT
+ return commands.MESSAGE_LIST
}
func (Connection) Aliases() []string {
diff --git a/commands/account/expand-folder.go b/commands/account/expand-folder.go
index 5bb686e0..8eafa0ed 100644
--- a/commands/account/expand-folder.go
+++ b/commands/account/expand-folder.go
@@ -14,7 +14,7 @@ func init() {
}
func (ExpandCollapseFolder) Context() commands.CommandContext {
- return commands.ACCOUNT
+ return commands.MESSAGE_LIST
}
func (ExpandCollapseFolder) Aliases() []string {
diff --git a/commands/account/export-mbox.go b/commands/account/export-mbox.go
index 021eecc6..6422eae0 100644
--- a/commands/account/export-mbox.go
+++ b/commands/account/export-mbox.go
@@ -26,7 +26,7 @@ func init() {
}
func (ExportMbox) Context() commands.CommandContext {
- return commands.ACCOUNT
+ return commands.MESSAGE_LIST
}
func (ExportMbox) Aliases() []string {
diff --git a/commands/account/import-mbox.go b/commands/account/import-mbox.go
index 1b05f16d..cdf99c96 100644
--- a/commands/account/import-mbox.go
+++ b/commands/account/import-mbox.go
@@ -27,7 +27,7 @@ func init() {
}
func (ImportMbox) Context() commands.CommandContext {
- return commands.ACCOUNT
+ return commands.MESSAGE_LIST
}
func (ImportMbox) Aliases() []string {
diff --git a/commands/account/mkdir.go b/commands/account/mkdir.go
index 9776e8f7..dae407cd 100644
--- a/commands/account/mkdir.go
+++ b/commands/account/mkdir.go
@@ -19,7 +19,7 @@ func init() {
}
func (MakeDir) Context() commands.CommandContext {
- return commands.ACCOUNT
+ return commands.MESSAGE_LIST
}
func (MakeDir) Aliases() []string {
diff --git a/commands/account/next-folder.go b/commands/account/next-folder.go
index c16a7717..369249ce 100644
--- a/commands/account/next-folder.go
+++ b/commands/account/next-folder.go
@@ -16,7 +16,7 @@ func init() {
}
func (NextPrevFolder) Context() commands.CommandContext {
- return commands.ACCOUNT
+ return commands.MESSAGE_LIST
}
func (NextPrevFolder) Aliases() []string {
diff --git a/commands/account/next-result.go b/commands/account/next-result.go
index f36ba941..e49884cf 100644
--- a/commands/account/next-result.go
+++ b/commands/account/next-result.go
@@ -15,7 +15,7 @@ func init() {
}
func (NextPrevResult) Context() commands.CommandContext {
- return commands.ACCOUNT
+ return commands.MESSAGE_LIST
}
func (NextPrevResult) Aliases() []string {
diff --git a/commands/account/next.go b/commands/account/next.go
index 262e308d..4245dd60 100644
--- a/commands/account/next.go
+++ b/commands/account/next.go
@@ -24,7 +24,7 @@ func init() {
}
func (NextPrevMsg) Context() commands.CommandContext {
- return commands.ACCOUNT | commands.MESSAGE_VIEWER
+ return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER
}
func (np *NextPrevMsg) ParseAmount(arg string) error {
diff --git a/commands/account/query.go b/commands/account/query.go
index f116d405..fccdc756 100644
--- a/commands/account/query.go
+++ b/commands/account/query.go
@@ -22,7 +22,7 @@ func init() {
}
func (Query) Context() commands.CommandContext {
- return commands.ACCOUNT
+ return commands.MESSAGE_LIST
}
func (Query) Aliases() []string {
diff --git a/commands/account/recover.go b/commands/account/recover.go
index f38d9920..fb08f646 100644
--- a/commands/account/recover.go
+++ b/commands/account/recover.go
@@ -24,7 +24,7 @@ func init() {
}
func (Recover) Context() commands.CommandContext {
- return commands.ACCOUNT
+ return commands.MESSAGE_LIST
}
func (Recover) Aliases() []string {
diff --git a/commands/account/rmdir.go b/commands/account/rmdir.go
index 48ea3581..22e78a69 100644
--- a/commands/account/rmdir.go
+++ b/commands/account/rmdir.go
@@ -19,7 +19,7 @@ func init() {
}
func (RemoveDir) Context() commands.CommandContext {
- return commands.ACCOUNT
+ return commands.MESSAGE_LIST
}
func (RemoveDir) Aliases() []string {
diff --git a/commands/account/search.go b/commands/account/search.go
index d4e04803..e64e8154 100644
--- a/commands/account/search.go
+++ b/commands/account/search.go
@@ -38,7 +38,7 @@ func init() {
}
func (SearchFilter) Context() commands.CommandContext {
- return commands.ACCOUNT
+ return commands.MESSAGE_LIST
}
func (SearchFilter) Aliases() []string {
diff --git a/commands/account/select.go b/commands/account/select.go
index cbaaf6e9..f990a1a1 100644
--- a/commands/account/select.go
+++ b/commands/account/select.go
@@ -16,7 +16,7 @@ func init() {
}
func (SelectMessage) Context() commands.CommandContext {
- return commands.ACCOUNT
+ return commands.MESSAGE_LIST
}
func (SelectMessage) Aliases() []string {
diff --git a/commands/account/sort.go b/commands/account/sort.go
index 0e80aec8..b41d4920 100644
--- a/commands/account/sort.go
+++ b/commands/account/sort.go
@@ -22,7 +22,7 @@ func init() {
}
func (Sort) Context() commands.CommandContext {
- return commands.ACCOUNT
+ return commands.MESSAGE_LIST
}
func (Sort) Aliases() []string {
diff --git a/commands/account/split.go b/commands/account/split.go
index 5f09f21b..f866af78 100644
--- a/commands/account/split.go
+++ b/commands/account/split.go
@@ -19,7 +19,7 @@ func init() {
}
func (Split) Context() commands.CommandContext {
- return commands.ACCOUNT
+ return commands.MESSAGE_LIST
}
func (s *Split) ParseSize(arg string) error {
diff --git a/commands/account/view.go b/commands/account/view.go
index 4177b906..9fa531b7 100644
--- a/commands/account/view.go
+++ b/commands/account/view.go
@@ -21,7 +21,7 @@ func init() {
}
func (ViewMessage) Context() commands.CommandContext {
- return commands.ACCOUNT
+ return commands.MESSAGE_LIST
}
func (ViewMessage) Aliases() []string {
diff --git a/commands/commands.go b/commands/commands.go
index 71976d05..27e50bcf 100644
--- a/commands/commands.go
+++ b/commands/commands.go
@@ -26,13 +26,11 @@ const (
// available everywhere
GLOBAL
// only when a message list is focused
- ACCOUNT
- // only when a message composer is focused
- COMPOSE
- // only when a message list or message viewer is focused
- MESSAGE
+ MESSAGE_LIST
// only when a message viewer is focused
MESSAGE_VIEWER
+ // only when a message composer is focused
+ COMPOSE
// only when a terminal
TERMINAL
)
@@ -42,11 +40,11 @@ func CurrentContext() CommandContext {
switch app.SelectedTabContent().(type) {
case *app.AccountView:
- context |= ACCOUNT | MESSAGE
+ context |= MESSAGE_LIST
case *app.Composer:
context |= COMPOSE
case *app.MessageViewer:
- context |= MESSAGE | MESSAGE_VIEWER
+ context |= MESSAGE_VIEWER
case *app.Terminal:
context |= TERMINAL
}
diff --git a/commands/msg/archive.go b/commands/msg/archive.go
index 25f68c8a..0714a805 100644
--- a/commands/msg/archive.go
+++ b/commands/msg/archive.go
@@ -40,7 +40,7 @@ func init() {
}
func (Archive) Context() commands.CommandContext {
- return commands.MESSAGE
+ return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER
}
func (Archive) Aliases() []string {
diff --git a/commands/msg/bounce.go b/commands/msg/bounce.go
index d999007d..a268a15f 100644
--- a/commands/msg/bounce.go
+++ b/commands/msg/bounce.go
@@ -40,7 +40,7 @@ func (*Bounce) CompleteTo(arg string) []string {
}
func (Bounce) Context() commands.CommandContext {
- return commands.MESSAGE
+ return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER
}
func (b Bounce) Execute(args []string) error {
diff --git a/commands/msg/copy.go b/commands/msg/copy.go
index cd13421f..af44216f 100644
--- a/commands/msg/copy.go
+++ b/commands/msg/copy.go
@@ -24,7 +24,7 @@ func init() {
}
func (Copy) Context() commands.CommandContext {
- return commands.MESSAGE
+ return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER
}
func (Copy) Aliases() []string {
diff --git a/commands/msg/delete.go b/commands/msg/delete.go
index 19f44b43..0abde31c 100644
--- a/commands/msg/delete.go
+++ b/commands/msg/delete.go
@@ -20,7 +20,7 @@ func init() {
}
func (Delete) Context() commands.CommandContext {
- return commands.MESSAGE
+ return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER
}
func (Delete) Aliases() []string {
diff --git a/commands/msg/envelope.go b/commands/msg/envelope.go
index f95af959..9b168fae 100644
--- a/commands/msg/envelope.go
+++ b/commands/msg/envelope.go
@@ -23,7 +23,7 @@ func init() {
}
func (Envelope) Context() commands.CommandContext {
- return commands.MESSAGE
+ return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER
}
func (Envelope) Aliases() []string {
diff --git a/commands/msg/fold.go b/commands/msg/fold.go
index 057d454e..7942e965 100644
--- a/commands/msg/fold.go
+++ b/commands/msg/fold.go
@@ -17,7 +17,7 @@ func init() {
}
func (Fold) Context() commands.CommandContext {
- return commands.MESSAGE
+ return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER
}
func (Fold) Aliases() []string {
diff --git a/commands/msg/forward.go b/commands/msg/forward.go
index c40f7aa5..ff5dbde7 100644
--- a/commands/msg/forward.go
+++ b/commands/msg/forward.go
@@ -38,7 +38,7 @@ func init() {
}
func (forward) Context() commands.CommandContext {
- return commands.MESSAGE
+ return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER
}
func (forward) Aliases() []string {
diff --git a/commands/msg/invite.go b/commands/msg/invite.go
index 0d45c43f..c62397c5 100644
--- a/commands/msg/invite.go
+++ b/commands/msg/invite.go
@@ -26,7 +26,7 @@ func init() {
}
func (invite) Context() commands.CommandContext {
- return commands.MESSAGE
+ return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER
}
func (invite) Aliases() []string {
diff --git a/commands/msg/mark.go b/commands/msg/mark.go
index f86c3413..5717e33d 100644
--- a/commands/msg/mark.go
+++ b/commands/msg/mark.go
@@ -19,7 +19,7 @@ func init() {
}
func (Mark) Context() commands.CommandContext {
- return commands.MESSAGE
+ return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER
}
func (Mark) Aliases() []string {
diff --git a/commands/msg/modify-labels.go b/commands/msg/modify-labels.go
index e2637805..90536b91 100644
--- a/commands/msg/modify-labels.go
+++ b/commands/msg/modify-labels.go
@@ -17,7 +17,7 @@ func init() {
}
func (ModifyLabels) Context() commands.CommandContext {
- return commands.MESSAGE
+ return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER
}
func (ModifyLabels) Aliases() []string {
diff --git a/commands/msg/move.go b/commands/msg/move.go
index 66738c68..d2623268 100644
--- a/commands/msg/move.go
+++ b/commands/msg/move.go
@@ -27,7 +27,7 @@ func init() {
}
func (Move) Context() commands.CommandContext {
- return commands.MESSAGE
+ return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER
}
func (Move) Aliases() []string {
diff --git a/commands/msg/pipe.go b/commands/msg/pipe.go
index 7048e6b8..7135df01 100644
--- a/commands/msg/pipe.go
+++ b/commands/msg/pipe.go
@@ -29,7 +29,7 @@ func init() {
}
func (Pipe) Context() commands.CommandContext {
- return commands.MESSAGE
+ return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER
}
func (Pipe) Aliases() []string {
diff --git a/commands/msg/read.go b/commands/msg/read.go
index 5b4bd073..cf85fd66 100644
--- a/commands/msg/read.go
+++ b/commands/msg/read.go
@@ -23,7 +23,7 @@ func init() {
}
func (FlagMsg) Context() commands.CommandContext {
- return commands.MESSAGE
+ return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER
}
func (FlagMsg) Aliases() []string {
diff --git a/commands/msg/recall.go b/commands/msg/recall.go
index 0c7f6b53..280c41b8 100644
--- a/commands/msg/recall.go
+++ b/commands/msg/recall.go
@@ -30,7 +30,7 @@ func init() {
}
func (Recall) Context() commands.CommandContext {
- return commands.MESSAGE
+ return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER
}
func (Recall) Aliases() []string {
diff --git a/commands/msg/reply.go b/commands/msg/reply.go
index 8eb2ff0d..02cf42ce 100644
--- a/commands/msg/reply.go
+++ b/commands/msg/reply.go
@@ -37,7 +37,7 @@ func init() {
}
func (reply) Context() commands.CommandContext {
- return commands.MESSAGE
+ return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER
}
func (reply) Aliases() []string {
diff --git a/commands/msg/toggle-thread-context.go b/commands/msg/toggle-thread-context.go
index dfae3a22..83dc87bd 100644
--- a/commands/msg/toggle-thread-context.go
+++ b/commands/msg/toggle-thread-context.go
@@ -12,7 +12,7 @@ func init() {
}
func (ToggleThreadContext) Context() commands.CommandContext {
- return commands.MESSAGE
+ return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER
}
func (ToggleThreadContext) Aliases() []string {
diff --git a/commands/msg/toggle-threads.go b/commands/msg/toggle-threads.go
index 21accc2c..66fa594d 100644
--- a/commands/msg/toggle-threads.go
+++ b/commands/msg/toggle-threads.go
@@ -13,7 +13,7 @@ func init() {
}
func (ToggleThreads) Context() commands.CommandContext {
- return commands.MESSAGE
+ return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER
}
func (ToggleThreads) Aliases() []string {
diff --git a/commands/msg/unsubscribe.go b/commands/msg/unsubscribe.go
index 3a9e2f51..62f33f4d 100644
--- a/commands/msg/unsubscribe.go
+++ b/commands/msg/unsubscribe.go
@@ -28,7 +28,7 @@ func init() {
}
func (Unsubscribe) Context() commands.CommandContext {
- return commands.MESSAGE
+ return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER
}
// Aliases returns a list of aliases for the :unsubscribe command
diff --git a/commands/patch/apply.go b/commands/patch/apply.go
index c9818876..6554ad8b 100644
--- a/commands/patch/apply.go
+++ b/commands/patch/apply.go
@@ -25,7 +25,7 @@ func init() {
}
func (Apply) Context() commands.CommandContext {
- return commands.MESSAGE
+ return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER
}
func (Apply) Aliases() []string {