diff options
-rw-r--r-- | aerc.go | 8 | ||||
-rw-r--r-- | commands/terminal/close.go (renamed from commands/term-close.go) | 7 | ||||
-rw-r--r-- | commands/terminal/terminal.go | 16 |
3 files changed, 26 insertions, 5 deletions
diff --git a/aerc.go b/aerc.go index d086f85..c2bc69c 100644 --- a/aerc.go +++ b/aerc.go @@ -12,6 +12,7 @@ import ( "git.sr.ht/~sircmpwn/aerc2/config" "git.sr.ht/~sircmpwn/aerc2/commands" "git.sr.ht/~sircmpwn/aerc2/commands/account" + "git.sr.ht/~sircmpwn/aerc2/commands/terminal" libui "git.sr.ht/~sircmpwn/aerc2/lib/ui" "git.sr.ht/~sircmpwn/aerc2/widgets" ) @@ -20,8 +21,13 @@ func getCommands(selected libui.Drawable) []*commands.Commands { switch selected.(type) { case *widgets.AccountView: return []*commands.Commands{ - commands.GlobalCommands, account.AccountCommands, + commands.GlobalCommands, + } + case *widgets.TermHost: + return []*commands.Commands{ + terminal.TerminalCommands, + commands.GlobalCommands, } default: return []*commands.Commands{commands.GlobalCommands} diff --git a/commands/term-close.go b/commands/terminal/close.go index 7da4f42..68be6ac 100644 --- a/commands/term-close.go +++ b/commands/terminal/close.go @@ -1,4 +1,4 @@ -package commands +package terminal import ( "errors" @@ -7,11 +7,10 @@ import ( ) func init() { - // TODO: Move this command into a terminal-specific command set - register("close", TermClose) + register("close", CommandClose) } -func TermClose(aerc *widgets.Aerc, args []string) error { +func CommandClose(aerc *widgets.Aerc, args []string) error { if len(args) != 1 { return errors.New("Usage: close") } diff --git a/commands/terminal/terminal.go b/commands/terminal/terminal.go new file mode 100644 index 0000000..f438582 --- /dev/null +++ b/commands/terminal/terminal.go @@ -0,0 +1,16 @@ +package terminal + +import ( + "git.sr.ht/~sircmpwn/aerc2/commands" +) + +var ( + TerminalCommands *commands.Commands +) + +func register(name string, cmd commands.AercCommand) { + if TerminalCommands == nil { + TerminalCommands = commands.NewCommands() + } + TerminalCommands.Register(name, cmd) +} |