aboutsummaryrefslogtreecommitdiffstats
path: root/commands/terminal
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/terminal
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/terminal')
-rw-r--r--commands/terminal/close.go21
-rw-r--r--commands/terminal/terminal.go14
2 files changed, 0 insertions, 35 deletions
diff --git a/commands/terminal/close.go b/commands/terminal/close.go
deleted file mode 100644
index 610a8463..00000000
--- a/commands/terminal/close.go
+++ /dev/null
@@ -1,21 +0,0 @@
-package terminal
-
-import (
- "git.sr.ht/~rjarry/aerc/app"
-)
-
-type Close struct{}
-
-func init() {
- register(Close{})
-}
-
-func (Close) Aliases() []string {
- return []string{"close"}
-}
-
-func (Close) Execute(args []string) error {
- term, _ := app.SelectedTabContent().(*app.Terminal)
- term.Close()
- return nil
-}
diff --git a/commands/terminal/terminal.go b/commands/terminal/terminal.go
deleted file mode 100644
index edc8429f..00000000
--- a/commands/terminal/terminal.go
+++ /dev/null
@@ -1,14 +0,0 @@
-package terminal
-
-import (
- "git.sr.ht/~rjarry/aerc/commands"
-)
-
-var TerminalCommands *commands.Commands
-
-func register(cmd commands.Command) {
- if TerminalCommands == nil {
- TerminalCommands = commands.NewCommands()
- }
- TerminalCommands.Register(cmd)
-}