From 26033eaecfe6733b2f911dea283433df11773256 Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Sat, 12 Oct 2024 00:21:45 +0200 Subject: completion: add commands descriptions Update the Command interface to include a Description() method. Implement the method for all commands using short descriptions inspired from the aerc(1) man page. Return the description values along with command names so that they can be displayed in completion choices. Implements: https://todo.sr.ht/~rjarry/aerc/271 Signed-off-by: Robin Jarry Tested-by: Bojan Gabric Tested-by: Jason Cox Acked-by: Tim Culverhouse --- commands/account/align.go | 4 ++++ commands/account/cf.go | 4 ++++ commands/account/check-mail.go | 4 ++++ commands/account/clear.go | 4 ++++ commands/account/compose.go | 4 ++++ commands/account/connection.go | 4 ++++ commands/account/expand-folder.go | 4 ++++ commands/account/export-mbox.go | 4 ++++ commands/account/import-mbox.go | 4 ++++ commands/account/mkdir.go | 4 ++++ commands/account/next-folder.go | 4 ++++ commands/account/next-result.go | 4 ++++ commands/account/next.go | 4 ++++ commands/account/query.go | 4 ++++ commands/account/recover.go | 4 ++++ commands/account/rmdir.go | 4 ++++ commands/account/search.go | 4 ++++ commands/account/select.go | 4 ++++ commands/account/sort.go | 4 ++++ commands/account/split.go | 4 ++++ commands/account/view.go | 4 ++++ commands/cd.go | 4 ++++ commands/choose.go | 4 ++++ commands/close.go | 4 ++++ commands/commands.go | 7 +++++++ commands/compose/abort.go | 4 ++++ commands/compose/attach-key.go | 4 ++++ commands/compose/attach.go | 4 ++++ commands/compose/cc-bcc.go | 4 ++++ commands/compose/detach.go | 4 ++++ commands/compose/edit.go | 4 ++++ commands/compose/encrypt.go | 4 ++++ commands/compose/header.go | 4 ++++ commands/compose/multipart.go | 4 ++++ commands/compose/next-field.go | 4 ++++ commands/compose/postpone.go | 4 ++++ commands/compose/send.go | 4 ++++ commands/compose/sign.go | 4 ++++ commands/compose/switch.go | 4 ++++ commands/ct.go | 4 ++++ commands/echo.go | 4 ++++ commands/eml.go | 4 ++++ commands/exec.go | 4 ++++ commands/help.go | 4 ++++ commands/menu.go | 4 ++++ commands/move-tab.go | 4 ++++ commands/msg/archive.go | 4 ++++ commands/msg/bounce.go | 4 ++++ commands/msg/copy.go | 4 ++++ commands/msg/delete.go | 4 ++++ commands/msg/envelope.go | 4 ++++ commands/msg/fold.go | 4 ++++ commands/msg/forward.go | 4 ++++ commands/msg/invite.go | 4 ++++ commands/msg/mark.go | 4 ++++ commands/msg/modify-labels.go | 4 ++++ commands/msg/move.go | 4 ++++ commands/msg/pipe.go | 4 ++++ commands/msg/read.go | 4 ++++ commands/msg/recall.go | 4 ++++ commands/msg/reply.go | 4 ++++ commands/msg/toggle-thread-context.go | 4 ++++ commands/msg/toggle-threads.go | 4 ++++ commands/msg/unsubscribe.go | 4 ++++ commands/msgview/next-part.go | 4 ++++ commands/msgview/open-link.go | 4 ++++ commands/msgview/open.go | 8 ++++---- commands/msgview/save.go | 8 ++++---- commands/msgview/toggle-headers.go | 4 ++++ commands/msgview/toggle-key-passthrough.go | 4 ++++ commands/new-account.go | 4 ++++ commands/next-tab.go | 4 ++++ commands/patch/apply.go | 4 ++++ commands/patch/cd.go | 4 ++++ commands/patch/drop.go | 4 ++++ commands/patch/find.go | 4 ++++ commands/patch/init.go | 4 ++++ commands/patch/list.go | 4 ++++ commands/patch/patch.go | 4 ++++ commands/patch/rebase.go | 4 ++++ commands/patch/switch.go | 4 ++++ commands/patch/term.go | 4 ++++ commands/patch/unlink.go | 4 ++++ commands/pin-tab.go | 4 ++++ commands/prompt.go | 4 ++++ commands/pwd.go | 4 ++++ commands/quit.go | 4 ++++ commands/redraw.go | 4 ++++ commands/reload.go | 4 ++++ commands/send-keys.go | 4 ++++ commands/suspend.go | 4 ++++ commands/term.go | 4 ++++ commands/z.go | 4 ++++ 93 files changed, 375 insertions(+), 8 deletions(-) (limited to 'commands') diff --git a/commands/account/align.go b/commands/account/align.go index e4c1379a..83bb5b64 100644 --- a/commands/account/align.go +++ b/commands/account/align.go @@ -16,6 +16,10 @@ func init() { commands.Register(Align{}) } +func (Align) Description() string { + return "Align the message list view." +} + var posNames []string = []string{"top", "center", "bottom"} func (a *Align) ParsePos(arg string) error { diff --git a/commands/account/cf.go b/commands/account/cf.go index 2c2cee53..3cce37a3 100644 --- a/commands/account/cf.go +++ b/commands/account/cf.go @@ -22,6 +22,10 @@ func init() { commands.Register(ChangeFolder{}) } +func (ChangeFolder) Description() string { + return "Change the folder shown in the message list." +} + func (ChangeFolder) Context() commands.CommandContext { return commands.MESSAGE_LIST } diff --git a/commands/account/check-mail.go b/commands/account/check-mail.go index d82fa042..507fdc38 100644 --- a/commands/account/check-mail.go +++ b/commands/account/check-mail.go @@ -13,6 +13,10 @@ func init() { commands.Register(CheckMail{}) } +func (CheckMail) Description() string { + return "Check for new mail on the selected account." +} + func (CheckMail) Context() commands.CommandContext { return commands.MESSAGE_LIST } diff --git a/commands/account/clear.go b/commands/account/clear.go index ec033c46..e16b563a 100644 --- a/commands/account/clear.go +++ b/commands/account/clear.go @@ -16,6 +16,10 @@ func init() { commands.Register(Clear{}) } +func (Clear) Description() string { + return "Clear the current search or filter criteria." +} + func (Clear) Context() commands.CommandContext { return commands.MESSAGE_LIST } diff --git a/commands/account/compose.go b/commands/account/compose.go index c9e36379..9eeb339b 100644 --- a/commands/account/compose.go +++ b/commands/account/compose.go @@ -27,6 +27,10 @@ func init() { commands.Register(Compose{}) } +func (Compose) Description() string { + return "Open the compose window to write a new email." +} + func (Compose) Context() commands.CommandContext { return commands.MESSAGE_LIST } diff --git a/commands/account/connection.go b/commands/account/connection.go index 126c79f1..7ea1ef0b 100644 --- a/commands/account/connection.go +++ b/commands/account/connection.go @@ -15,6 +15,10 @@ func init() { commands.Register(Connection{}) } +func (Connection) Description() string { + return "Disconnect or reconnect the current account." +} + func (Connection) Context() commands.CommandContext { return commands.MESSAGE_LIST } diff --git a/commands/account/expand-folder.go b/commands/account/expand-folder.go index 8eafa0ed..8b1a8c66 100644 --- a/commands/account/expand-folder.go +++ b/commands/account/expand-folder.go @@ -13,6 +13,10 @@ func init() { commands.Register(ExpandCollapseFolder{}) } +func (ExpandCollapseFolder) Description() string { + return "Expand or collapse the current folder." +} + func (ExpandCollapseFolder) Context() commands.CommandContext { return commands.MESSAGE_LIST } diff --git a/commands/account/export-mbox.go b/commands/account/export-mbox.go index 619c24a2..fed8568e 100644 --- a/commands/account/export-mbox.go +++ b/commands/account/export-mbox.go @@ -26,6 +26,10 @@ func init() { commands.Register(ExportMbox{}) } +func (ExportMbox) Description() string { + return "Export messages in the current folder to an mbox file." +} + func (ExportMbox) Context() commands.CommandContext { return commands.MESSAGE_LIST } diff --git a/commands/account/import-mbox.go b/commands/account/import-mbox.go index cdf99c96..946098e5 100644 --- a/commands/account/import-mbox.go +++ b/commands/account/import-mbox.go @@ -26,6 +26,10 @@ func init() { commands.Register(ImportMbox{}) } +func (ImportMbox) Description() string { + return "Import all messages from an mbox file to the current folder." +} + func (ImportMbox) Context() commands.CommandContext { return commands.MESSAGE_LIST } diff --git a/commands/account/mkdir.go b/commands/account/mkdir.go index d6a6f9f3..cf8763be 100644 --- a/commands/account/mkdir.go +++ b/commands/account/mkdir.go @@ -18,6 +18,10 @@ func init() { commands.Register(MakeDir{}) } +func (MakeDir) Description() string { + return "Create and change to a new folder." +} + func (MakeDir) Context() commands.CommandContext { return commands.MESSAGE_LIST } diff --git a/commands/account/next-folder.go b/commands/account/next-folder.go index 369249ce..eb075315 100644 --- a/commands/account/next-folder.go +++ b/commands/account/next-folder.go @@ -15,6 +15,10 @@ func init() { commands.Register(NextPrevFolder{}) } +func (NextPrevFolder) Description() string { + return "Cycle to the next or previous folder shown in the sidebar." +} + func (NextPrevFolder) Context() commands.CommandContext { return commands.MESSAGE_LIST } diff --git a/commands/account/next-result.go b/commands/account/next-result.go index e49884cf..0fb7d0a1 100644 --- a/commands/account/next-result.go +++ b/commands/account/next-result.go @@ -14,6 +14,10 @@ func init() { commands.Register(NextPrevResult{}) } +func (NextPrevResult) Description() string { + return "Select the next or previous search result." +} + func (NextPrevResult) Context() commands.CommandContext { return commands.MESSAGE_LIST } diff --git a/commands/account/next.go b/commands/account/next.go index 92624316..5454f1e5 100644 --- a/commands/account/next.go +++ b/commands/account/next.go @@ -23,6 +23,10 @@ func init() { commands.Register(NextPrevMsg{}) } +func (NextPrevMsg) Description() string { + return "Select the next or previous message in the message list." +} + func (NextPrevMsg) Context() commands.CommandContext { return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER } diff --git a/commands/account/query.go b/commands/account/query.go index 65b5e063..da8a8c06 100644 --- a/commands/account/query.go +++ b/commands/account/query.go @@ -21,6 +21,10 @@ func init() { commands.Register(Query{}) } +func (Query) Description() string { + return "Create a virtual folder using the specified notmuch query." +} + func (Query) Context() commands.CommandContext { return commands.MESSAGE_LIST } diff --git a/commands/account/recover.go b/commands/account/recover.go index fb08f646..625ac122 100644 --- a/commands/account/recover.go +++ b/commands/account/recover.go @@ -23,6 +23,10 @@ func init() { commands.Register(Recover{}) } +func (Recover) Description() string { + return "Resume composing a message that was not sent nor postponed." +} + func (Recover) Context() commands.CommandContext { return commands.MESSAGE_LIST } diff --git a/commands/account/rmdir.go b/commands/account/rmdir.go index 3c5b24d7..852d717b 100644 --- a/commands/account/rmdir.go +++ b/commands/account/rmdir.go @@ -21,6 +21,10 @@ func init() { commands.Register(RemoveDir{}) } +func (RemoveDir) Description() string { + return "Remove folder." +} + func (RemoveDir) Context() commands.CommandContext { return commands.MESSAGE_LIST } diff --git a/commands/account/search.go b/commands/account/search.go index 14aa367b..5dde3322 100644 --- a/commands/account/search.go +++ b/commands/account/search.go @@ -39,6 +39,10 @@ func init() { commands.Register(SearchFilter{}) } +func (SearchFilter) Description() string { + return "Search or filter the current folder." +} + func (SearchFilter) Context() commands.CommandContext { return commands.MESSAGE_LIST } diff --git a/commands/account/select.go b/commands/account/select.go index f990a1a1..dda76af4 100644 --- a/commands/account/select.go +++ b/commands/account/select.go @@ -15,6 +15,10 @@ func init() { commands.Register(SelectMessage{}) } +func (SelectMessage) Description() string { + return "Select the th message in the message list." +} + func (SelectMessage) Context() commands.CommandContext { return commands.MESSAGE_LIST } diff --git a/commands/account/sort.go b/commands/account/sort.go index b41d4920..16060aa0 100644 --- a/commands/account/sort.go +++ b/commands/account/sort.go @@ -21,6 +21,10 @@ func init() { commands.Register(Sort{}) } +func (Sort) Description() string { + return "Sort the message list by the given criteria." +} + func (Sort) Context() commands.CommandContext { return commands.MESSAGE_LIST } diff --git a/commands/account/split.go b/commands/account/split.go index f866af78..efa89fc7 100644 --- a/commands/account/split.go +++ b/commands/account/split.go @@ -18,6 +18,10 @@ func init() { commands.Register(Split{}) } +func (Split) Description() string { + return "Split the message list with a preview pane." +} + func (Split) Context() commands.CommandContext { return commands.MESSAGE_LIST } diff --git a/commands/account/view.go b/commands/account/view.go index 5f5bd289..0e3ca09c 100644 --- a/commands/account/view.go +++ b/commands/account/view.go @@ -21,6 +21,10 @@ func init() { commands.Register(ViewMessage{}) } +func (ViewMessage) Description() string { + return "View the selected message in a new tab." +} + func (ViewMessage) Context() commands.CommandContext { return commands.MESSAGE_LIST } diff --git a/commands/cd.go b/commands/cd.go index 1d71882f..27333807 100644 --- a/commands/cd.go +++ b/commands/cd.go @@ -18,6 +18,10 @@ func init() { Register(ChangeDirectory{}) } +func (ChangeDirectory) Description() string { + return "Change aerc's current working directory." +} + func (ChangeDirectory) Context() CommandContext { return GLOBAL } diff --git a/commands/choose.go b/commands/choose.go index 4ecff0ea..6c3906c4 100644 --- a/commands/choose.go +++ b/commands/choose.go @@ -14,6 +14,10 @@ func init() { Register(Choose{}) } +func (Choose) Description() string { + return "Prompt to choose from various options." +} + func (Choose) Context() CommandContext { return GLOBAL } diff --git a/commands/close.go b/commands/close.go index c74a705e..177c54a7 100644 --- a/commands/close.go +++ b/commands/close.go @@ -10,6 +10,10 @@ func init() { Register(Close{}) } +func (Close) Description() string { + return "Close the focused tab." +} + func (Close) Context() CommandContext { return MESSAGE_VIEWER | TERMINAL } diff --git a/commands/commands.go b/commands/commands.go index e87cd802..a06e8ef9 100644 --- a/commands/commands.go +++ b/commands/commands.go @@ -53,6 +53,7 @@ func CurrentContext() CommandContext { } type Command interface { + Description() string Context() CommandContext Aliases() []string Execute([]string) error @@ -75,8 +76,14 @@ func Register(cmd Command) { func ActiveCommands() []Command { var cmds []Command context := CurrentContext() + seen := make(map[reflect.Type]bool) for _, cmd := range allCommands { + t := reflect.TypeOf(cmd) + if seen[t] { + continue + } + seen[t] = true if cmd.Context()&context != 0 { cmds = append(cmds, cmd) } diff --git a/commands/compose/abort.go b/commands/compose/abort.go index f446c306..a6d50e4e 100644 --- a/commands/compose/abort.go +++ b/commands/compose/abort.go @@ -11,6 +11,10 @@ func init() { commands.Register(Abort{}) } +func (Abort) Description() string { + return "Close the composer without sending." +} + func (Abort) Context() commands.CommandContext { return commands.COMPOSE } diff --git a/commands/compose/attach-key.go b/commands/compose/attach-key.go index 047b9c08..0030e7ed 100644 --- a/commands/compose/attach-key.go +++ b/commands/compose/attach-key.go @@ -11,6 +11,10 @@ func init() { commands.Register(AttachKey{}) } +func (AttachKey) Description() string { + return "Attach the public key of the current account." +} + func (AttachKey) Context() commands.CommandContext { return commands.COMPOSE } diff --git a/commands/compose/attach.go b/commands/compose/attach.go index c86b0f4f..f811f5a8 100644 --- a/commands/compose/attach.go +++ b/commands/compose/attach.go @@ -31,6 +31,10 @@ func init() { commands.Register(Attach{}) } +func (Attach) Description() string { + return "Attach the file at the given path to the email." +} + func (Attach) Context() commands.CommandContext { return commands.COMPOSE } diff --git a/commands/compose/cc-bcc.go b/commands/compose/cc-bcc.go index 92f792f1..a3c1c188 100644 --- a/commands/compose/cc-bcc.go +++ b/commands/compose/cc-bcc.go @@ -13,6 +13,10 @@ func init() { commands.Register(CC{}) } +func (CC) Description() string { + return "Add the given address(es) to the Cc or Bcc header." +} + func (CC) Context() commands.CommandContext { return commands.COMPOSE } diff --git a/commands/compose/detach.go b/commands/compose/detach.go index 69f8538d..ddf2e24f 100644 --- a/commands/compose/detach.go +++ b/commands/compose/detach.go @@ -18,6 +18,10 @@ func init() { commands.Register(Detach{}) } +func (Detach) Description() string { + return "Detach the file with the given path from the composed email." +} + func (Detach) Context() commands.CommandContext { return commands.COMPOSE } diff --git a/commands/compose/edit.go b/commands/compose/edit.go index 45c55046..f02848b7 100644 --- a/commands/compose/edit.go +++ b/commands/compose/edit.go @@ -17,6 +17,10 @@ func init() { commands.Register(Edit{}) } +func (Edit) Description() string { + return "(Re-)open text editor to edit the message in progress." +} + func (Edit) Context() commands.CommandContext { return commands.COMPOSE } diff --git a/commands/compose/encrypt.go b/commands/compose/encrypt.go index 5e52f821..1e6be815 100644 --- a/commands/compose/encrypt.go +++ b/commands/compose/encrypt.go @@ -11,6 +11,10 @@ func init() { commands.Register(Encrypt{}) } +func (Encrypt) Description() string { + return "Toggle encryption of the message to all recipients." +} + func (Encrypt) Context() commands.CommandContext { return commands.COMPOSE } diff --git a/commands/compose/header.go b/commands/compose/header.go index 839896c3..64c1c37d 100644 --- a/commands/compose/header.go +++ b/commands/compose/header.go @@ -29,6 +29,10 @@ func init() { commands.Register(Header{}) } +func (Header) Description() string { + return "Add or remove the specified email header." +} + func (Header) Context() commands.CommandContext { return commands.COMPOSE } diff --git a/commands/compose/multipart.go b/commands/compose/multipart.go index a38e0a6e..87f4d030 100644 --- a/commands/compose/multipart.go +++ b/commands/compose/multipart.go @@ -17,6 +17,10 @@ func init() { commands.Register(Multipart{}) } +func (Multipart) Description() string { + return "Convert the message to multipart with the given mime-type part." +} + func (Multipart) Context() commands.CommandContext { return commands.COMPOSE } diff --git a/commands/compose/next-field.go b/commands/compose/next-field.go index 6c96cd94..e21a8f8b 100644 --- a/commands/compose/next-field.go +++ b/commands/compose/next-field.go @@ -11,6 +11,10 @@ func init() { commands.Register(NextPrevField{}) } +func (NextPrevField) Description() string { + return "Cycle between header input fields." +} + func (NextPrevField) Context() commands.CommandContext { return commands.COMPOSE } diff --git a/commands/compose/postpone.go b/commands/compose/postpone.go index d5b3ed2f..3dd55554 100644 --- a/commands/compose/postpone.go +++ b/commands/compose/postpone.go @@ -21,6 +21,10 @@ func init() { commands.Register(Postpone{}) } +func (Postpone) Description() string { + return "Save the current state of the message to the postpone folder." +} + func (Postpone) Context() commands.CommandContext { return commands.COMPOSE } diff --git a/commands/compose/send.go b/commands/compose/send.go index 1e30bd0e..0d184bcf 100644 --- a/commands/compose/send.go +++ b/commands/compose/send.go @@ -35,6 +35,10 @@ func init() { commands.Register(Send{}) } +func (Send) Description() string { + return "Send the message using the configured outgoing transport." +} + func (Send) Context() commands.CommandContext { return commands.COMPOSE } diff --git a/commands/compose/sign.go b/commands/compose/sign.go index 692ef108..3f9cacff 100644 --- a/commands/compose/sign.go +++ b/commands/compose/sign.go @@ -13,6 +13,10 @@ func init() { commands.Register(Sign{}) } +func (Sign) Description() string { + return "Sign the message using the account default key." +} + func (Sign) Context() commands.CommandContext { return commands.COMPOSE } diff --git a/commands/compose/switch.go b/commands/compose/switch.go index c9d1013c..4bcfc136 100644 --- a/commands/compose/switch.go +++ b/commands/compose/switch.go @@ -21,6 +21,10 @@ func init() { commands.Register(SwitchAccount{}) } +func (SwitchAccount) Description() string { + return "Change composing from the specified account." +} + func (SwitchAccount) Context() commands.CommandContext { return commands.COMPOSE } diff --git a/commands/ct.go b/commands/ct.go index 4f908fcf..be3d4e98 100644 --- a/commands/ct.go +++ b/commands/ct.go @@ -16,6 +16,10 @@ func init() { Register(ChangeTab{}) } +func (ChangeTab) Description() string { + return "Change the focus to the specified tab." +} + func (ChangeTab) Context() CommandContext { return GLOBAL } diff --git a/commands/echo.go b/commands/echo.go index ebe997da..819b30d6 100644 --- a/commands/echo.go +++ b/commands/echo.go @@ -12,6 +12,10 @@ func init() { Register(Echo{}) } +func (Echo) Description() string { + return "Print text after template expansion." +} + func (Echo) Aliases() []string { return []string{"echo"} } diff --git a/commands/eml.go b/commands/eml.go index fa126729..d4323a29 100644 --- a/commands/eml.go +++ b/commands/eml.go @@ -19,6 +19,10 @@ func init() { Register(Eml{}) } +func (Eml) Description() string { + return "Open an eml file into the message viewer." +} + func (Eml) Context() CommandContext { return GLOBAL } diff --git a/commands/exec.go b/commands/exec.go index ac33cf21..5b7d7f69 100644 --- a/commands/exec.go +++ b/commands/exec.go @@ -18,6 +18,10 @@ func init() { Register(ExecCmd{}) } +func (ExecCmd) Description() string { + return "Execute an arbitrary command in the background." +} + func (ExecCmd) Context() CommandContext { return GLOBAL } diff --git a/commands/help.go b/commands/help.go index 079b2fd5..dab0af1a 100644 --- a/commands/help.go +++ b/commands/help.go @@ -32,6 +32,10 @@ func init() { Register(Help{}) } +func (Help) Description() string { + return "Display one of aerc's man pages in the embedded terminal." +} + func (Help) Context() CommandContext { return GLOBAL } diff --git a/commands/menu.go b/commands/menu.go index 08eec9cb..4db1a1d7 100644 --- a/commands/menu.go +++ b/commands/menu.go @@ -28,6 +28,10 @@ func init() { Register(Menu{}) } +func (Menu) Description() string { + return "Open a popover dialog." +} + func (Menu) Context() CommandContext { return GLOBAL } diff --git a/commands/move-tab.go b/commands/move-tab.go index c8e1b99a..a1ebfc0d 100644 --- a/commands/move-tab.go +++ b/commands/move-tab.go @@ -16,6 +16,10 @@ func init() { Register(MoveTab{}) } +func (MoveTab) Description() string { + return "Move the selected tab to the given index." +} + func (MoveTab) Context() CommandContext { return GLOBAL } diff --git a/commands/msg/archive.go b/commands/msg/archive.go index c262de41..0b4b8258 100644 --- a/commands/msg/archive.go +++ b/commands/msg/archive.go @@ -51,6 +51,10 @@ func init() { commands.Register(Archive{}) } +func (Archive) Description() string { + return "Move the selected message to the archive." +} + func (Archive) Context() commands.CommandContext { return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER } diff --git a/commands/msg/bounce.go b/commands/msg/bounce.go index 1460951d..0c0452b4 100644 --- a/commands/msg/bounce.go +++ b/commands/msg/bounce.go @@ -27,6 +27,10 @@ func init() { commands.Register(Bounce{}) } +func (Bounce) Description() string { + return "Re-send the selected message(s) to the specified addresses." +} + func (Bounce) Aliases() []string { return []string{"bounce", "resend"} } diff --git a/commands/msg/copy.go b/commands/msg/copy.go index 52a6ea6c..126dbd8e 100644 --- a/commands/msg/copy.go +++ b/commands/msg/copy.go @@ -28,6 +28,10 @@ func init() { commands.Register(Copy{}) } +func (Copy) Description() string { + return "Copy the selected message(s) to the specified folder." +} + func (Copy) Context() commands.CommandContext { return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER } diff --git a/commands/msg/delete.go b/commands/msg/delete.go index 2e41504a..4999045e 100644 --- a/commands/msg/delete.go +++ b/commands/msg/delete.go @@ -21,6 +21,10 @@ func init() { commands.Register(Delete{}) } +func (Delete) Description() string { + return "Delete the selected message(s)." +} + func (Delete) Context() commands.CommandContext { return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER } diff --git a/commands/msg/envelope.go b/commands/msg/envelope.go index 35243509..09e7fa19 100644 --- a/commands/msg/envelope.go +++ b/commands/msg/envelope.go @@ -22,6 +22,10 @@ func init() { commands.Register(Envelope{}) } +func (Envelope) Description() string { + return "Open the message envelope in a dialog popup." +} + func (Envelope) Context() commands.CommandContext { return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER } diff --git a/commands/msg/fold.go b/commands/msg/fold.go index 7942e965..d3ec2438 100644 --- a/commands/msg/fold.go +++ b/commands/msg/fold.go @@ -16,6 +16,10 @@ func init() { commands.Register(Fold{}) } +func (Fold) Description() string { + return "Collapse or expand the thread children of the selected message." +} + func (Fold) Context() commands.CommandContext { return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER } diff --git a/commands/msg/forward.go b/commands/msg/forward.go index d030636e..3bfad8cf 100644 --- a/commands/msg/forward.go +++ b/commands/msg/forward.go @@ -37,6 +37,10 @@ func init() { commands.Register(forward{}) } +func (forward) Description() string { + return "Open the composer to forward the selected message to another recipient." +} + func (forward) Context() commands.CommandContext { return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER } diff --git a/commands/msg/invite.go b/commands/msg/invite.go index 9a236e24..d9c16263 100644 --- a/commands/msg/invite.go +++ b/commands/msg/invite.go @@ -27,6 +27,10 @@ func init() { commands.Register(invite{}) } +func (invite) Description() string { + return "Accept or decline a meeting invitation." +} + func (invite) Context() commands.CommandContext { return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER } diff --git a/commands/msg/mark.go b/commands/msg/mark.go index 42110038..6c36dcd7 100644 --- a/commands/msg/mark.go +++ b/commands/msg/mark.go @@ -19,6 +19,10 @@ func init() { commands.Register(Mark{}) } +func (Mark) Description() string { + return "Mark, unmark or remark messages." +} + func (Mark) Context() commands.CommandContext { return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER } diff --git a/commands/msg/modify-labels.go b/commands/msg/modify-labels.go index 90536b91..e317440c 100644 --- a/commands/msg/modify-labels.go +++ b/commands/msg/modify-labels.go @@ -16,6 +16,10 @@ func init() { commands.Register(ModifyLabels{}) } +func (ModifyLabels) Description() string { + return "Modify message labels." +} + func (ModifyLabels) Context() commands.CommandContext { return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER } diff --git a/commands/msg/move.go b/commands/msg/move.go index 8e548bfe..63473b13 100644 --- a/commands/msg/move.go +++ b/commands/msg/move.go @@ -27,6 +27,10 @@ func init() { commands.Register(Move{}) } +func (Move) Description() string { + return "Move the selected message(s) to the specified folder." +} + func (Move) Context() commands.CommandContext { return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER } diff --git a/commands/msg/pipe.go b/commands/msg/pipe.go index 9764de82..f66e7dca 100644 --- a/commands/msg/pipe.go +++ b/commands/msg/pipe.go @@ -33,6 +33,10 @@ func init() { commands.Register(Pipe{}) } +func (Pipe) Description() string { + return "Pipe the selected message(s) into the given shell command." +} + func (Pipe) Context() commands.CommandContext { return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER } diff --git a/commands/msg/read.go b/commands/msg/read.go index 686c1a9e..e548c12b 100644 --- a/commands/msg/read.go +++ b/commands/msg/read.go @@ -23,6 +23,10 @@ func init() { commands.Register(FlagMsg{}) } +func (FlagMsg) Description() string { + return "Set or unset a flag on the marked or selected messages." +} + func (FlagMsg) Context() commands.CommandContext { return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER } diff --git a/commands/msg/recall.go b/commands/msg/recall.go index 15566414..5611f289 100644 --- a/commands/msg/recall.go +++ b/commands/msg/recall.go @@ -29,6 +29,10 @@ func init() { commands.Register(Recall{}) } +func (Recall) Description() string { + return "Open a postponed message for re-editing." +} + func (Recall) Context() commands.CommandContext { return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER } diff --git a/commands/msg/reply.go b/commands/msg/reply.go index aeb186f8..76f1e088 100644 --- a/commands/msg/reply.go +++ b/commands/msg/reply.go @@ -36,6 +36,10 @@ func init() { commands.Register(reply{}) } +func (reply) Description() string { + return "Open the composer to reply to the selected message." +} + func (reply) Context() commands.CommandContext { return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER } diff --git a/commands/msg/toggle-thread-context.go b/commands/msg/toggle-thread-context.go index 83dc87bd..fed87bad 100644 --- a/commands/msg/toggle-thread-context.go +++ b/commands/msg/toggle-thread-context.go @@ -11,6 +11,10 @@ func init() { commands.Register(ToggleThreadContext{}) } +func (ToggleThreadContext) Description() string { + return "Show/hide message thread context." +} + func (ToggleThreadContext) Context() commands.CommandContext { return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER } diff --git a/commands/msg/toggle-threads.go b/commands/msg/toggle-threads.go index 66fa594d..b8ebc15a 100644 --- a/commands/msg/toggle-threads.go +++ b/commands/msg/toggle-threads.go @@ -12,6 +12,10 @@ func init() { commands.Register(ToggleThreads{}) } +func (ToggleThreads) Description() string { + return "Toggle between message threading and the normal message list." +} + func (ToggleThreads) Context() commands.CommandContext { return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER } diff --git a/commands/msg/unsubscribe.go b/commands/msg/unsubscribe.go index 62f33f4d..46b86f30 100644 --- a/commands/msg/unsubscribe.go +++ b/commands/msg/unsubscribe.go @@ -27,6 +27,10 @@ func init() { commands.Register(Unsubscribe{}) } +func (Unsubscribe) Description() string { + return "Attempt to automatically unsubscribe from mailing lists." +} + func (Unsubscribe) Context() commands.CommandContext { return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER } diff --git a/commands/msgview/next-part.go b/commands/msgview/next-part.go index b5375d75..5f1a8fb6 100644 --- a/commands/msgview/next-part.go +++ b/commands/msgview/next-part.go @@ -13,6 +13,10 @@ func init() { commands.Register(NextPrevPart{}) } +func (NextPrevPart) Description() string { + return "Cycle between message parts being shown." +} + func (NextPrevPart) Context() commands.CommandContext { return commands.MESSAGE_VIEWER } diff --git a/commands/msgview/open-link.go b/commands/msgview/open-link.go index 9f02f795..00cc9314 100644 --- a/commands/msgview/open-link.go +++ b/commands/msgview/open-link.go @@ -19,6 +19,10 @@ func init() { commands.Register(OpenLink{}) } +func (OpenLink) Description() string { + return "Open the specified URL with an external program." +} + func (OpenLink) Context() commands.CommandContext { return commands.MESSAGE_VIEWER } diff --git a/commands/msgview/open.go b/commands/msgview/open.go index 1361b15e..7b23423d 100644 --- a/commands/msgview/open.go +++ b/commands/msgview/open.go @@ -22,12 +22,12 @@ func init() { commands.Register(Open{}) } -func (Open) Context() commands.CommandContext { - return commands.MESSAGE_VIEWER +func (Open) Description() string { + return "Save the current message part to a temporary file, then open it." } -func (Open) Options() string { - return "d" +func (Open) Context() commands.CommandContext { + return commands.MESSAGE_VIEWER } func (Open) Aliases() []string { diff --git a/commands/msgview/save.go b/commands/msgview/save.go index 1a219e93..0310ed0e 100644 --- a/commands/msgview/save.go +++ b/commands/msgview/save.go @@ -29,12 +29,12 @@ func init() { commands.Register(Save{}) } -func (Save) Context() commands.CommandContext { - return commands.MESSAGE_VIEWER +func (Save) Description() string { + return "Save the current message part to the given path." } -func (Save) Options() string { - return "fpaA" +func (Save) Context() commands.CommandContext { + return commands.MESSAGE_VIEWER } func (Save) Aliases() []string { diff --git a/commands/msgview/toggle-headers.go b/commands/msgview/toggle-headers.go index 201fce90..c2b4e8f7 100644 --- a/commands/msgview/toggle-headers.go +++ b/commands/msgview/toggle-headers.go @@ -11,6 +11,10 @@ func init() { commands.Register(ToggleHeaders{}) } +func (ToggleHeaders) Description() string { + return "Toggle the visibility of message headers." +} + func (ToggleHeaders) Context() commands.CommandContext { return commands.MESSAGE_VIEWER } diff --git a/commands/msgview/toggle-key-passthrough.go b/commands/msgview/toggle-key-passthrough.go index 1b3f8628..c972d18a 100644 --- a/commands/msgview/toggle-key-passthrough.go +++ b/commands/msgview/toggle-key-passthrough.go @@ -12,6 +12,10 @@ func init() { commands.Register(ToggleKeyPassthrough{}) } +func (ToggleKeyPassthrough) Description() string { + return "Enter or exit the passthrough key bindings context." +} + func (ToggleKeyPassthrough) Context() commands.CommandContext { return commands.MESSAGE_VIEWER } diff --git a/commands/new-account.go b/commands/new-account.go index 5a5499df..9792d7e1 100644 --- a/commands/new-account.go +++ b/commands/new-account.go @@ -12,6 +12,10 @@ func init() { Register(NewAccount{}) } +func (NewAccount) Description() string { + return "Start the new account wizard." +} + func (NewAccount) Context() CommandContext { return GLOBAL } diff --git a/commands/next-tab.go b/commands/next-tab.go index 12f659c9..466c4ff0 100644 --- a/commands/next-tab.go +++ b/commands/next-tab.go @@ -12,6 +12,10 @@ func init() { Register(NextPrevTab{}) } +func (NextPrevTab) Description() string { + return "Cycle to the previous or next tab." +} + func (NextPrevTab) Context() CommandContext { return GLOBAL } diff --git a/commands/patch/apply.go b/commands/patch/apply.go index 6554ad8b..12f5b3f8 100644 --- a/commands/patch/apply.go +++ b/commands/patch/apply.go @@ -24,6 +24,10 @@ func init() { register(Apply{}) } +func (Apply) Description() string { + return "Apply the selected message(s) to the current project." +} + func (Apply) Context() commands.CommandContext { return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER } diff --git a/commands/patch/cd.go b/commands/patch/cd.go index bbca1eba..70e92412 100644 --- a/commands/patch/cd.go +++ b/commands/patch/cd.go @@ -16,6 +16,10 @@ func init() { register(Cd{}) } +func (Cd) Description() string { + return "Change aerc's working directory to the current project." +} + func (Cd) Context() commands.CommandContext { return commands.GLOBAL } diff --git a/commands/patch/drop.go b/commands/patch/drop.go index a888568a..dbb1fb07 100644 --- a/commands/patch/drop.go +++ b/commands/patch/drop.go @@ -18,6 +18,10 @@ func init() { register(Drop{}) } +func (Drop) Description() string { + return "Drop a patch from the repository." +} + func (Drop) Context() commands.CommandContext { return commands.GLOBAL } diff --git a/commands/patch/find.go b/commands/patch/find.go index 10b96ef2..a74f926e 100644 --- a/commands/patch/find.go +++ b/commands/patch/find.go @@ -23,6 +23,10 @@ func init() { register(Find{}) } +func (Find) Description() string { + return "Search for applied patches." +} + func (Find) Context() commands.CommandContext { return commands.GLOBAL } diff --git a/commands/patch/init.go b/commands/patch/init.go index de0c6e45..b7316ee4 100644 --- a/commands/patch/init.go +++ b/commands/patch/init.go @@ -18,6 +18,10 @@ func init() { register(Init{}) } +func (Init) Description() string { + return "Create a new project." +} + func (Init) Context() commands.CommandContext { return commands.GLOBAL } diff --git a/commands/patch/list.go b/commands/patch/list.go index b05a9bf3..a9c68e4d 100644 --- a/commands/patch/list.go +++ b/commands/patch/list.go @@ -25,6 +25,10 @@ func init() { register(List{}) } +func (List) Description() string { + return "List the current project with the tracked patch sets." +} + func (List) Context() commands.CommandContext { return commands.GLOBAL } diff --git a/commands/patch/patch.go b/commands/patch/patch.go index 15fb35f4..0e19d888 100644 --- a/commands/patch/patch.go +++ b/commands/patch/patch.go @@ -31,6 +31,10 @@ func init() { commands.Register(Patch{}) } +func (Patch) Description() string { + return "Local patch management commands." +} + func (Patch) Context() commands.CommandContext { return commands.GLOBAL } diff --git a/commands/patch/rebase.go b/commands/patch/rebase.go index e99cc275..26b82f6d 100644 --- a/commands/patch/rebase.go +++ b/commands/patch/rebase.go @@ -28,6 +28,10 @@ func init() { register(Rebase{}) } +func (Rebase) Description() string { + return "Rebase the patch data." +} + func (Rebase) Context() commands.CommandContext { return commands.GLOBAL } diff --git a/commands/patch/switch.go b/commands/patch/switch.go index dc9138d8..9eb26ef2 100644 --- a/commands/patch/switch.go +++ b/commands/patch/switch.go @@ -18,6 +18,10 @@ func init() { register(Switch{}) } +func (Switch) Description() string { + return "Switch context to the specified project." +} + func (Switch) Context() commands.CommandContext { return commands.GLOBAL } diff --git a/commands/patch/term.go b/commands/patch/term.go index f9f79be1..c81f6995 100644 --- a/commands/patch/term.go +++ b/commands/patch/term.go @@ -13,6 +13,10 @@ func init() { register(Term{}) } +func (Term) Description() string { + return "Open a shell or run a command in the current project's directory." +} + func (Term) Context() commands.CommandContext { return commands.GLOBAL } diff --git a/commands/patch/unlink.go b/commands/patch/unlink.go index 2d24d25b..da21c15e 100644 --- a/commands/patch/unlink.go +++ b/commands/patch/unlink.go @@ -18,6 +18,10 @@ func init() { register(Unlink{}) } +func (Unlink) Description() string { + return "Delete all patch tracking data for the specified project." +} + func (Unlink) Context() commands.CommandContext { return commands.GLOBAL } diff --git a/commands/pin-tab.go b/commands/pin-tab.go index aaac356d..8ec6d24e 100644 --- a/commands/pin-tab.go +++ b/commands/pin-tab.go @@ -10,6 +10,10 @@ func init() { Register(PinTab{}) } +func (PinTab) Description() string { + return "Move the current tab to the left and mark it as pinned." +} + func (PinTab) Context() CommandContext { return GLOBAL } diff --git a/commands/prompt.go b/commands/prompt.go index fe6632e9..dc965dd0 100644 --- a/commands/prompt.go +++ b/commands/prompt.go @@ -15,6 +15,10 @@ func init() { Register(Prompt{}) } +func (Prompt) Description() string { + return "Prompt for user input and execute a command." +} + func (Prompt) Context() CommandContext { return GLOBAL } diff --git a/commands/pwd.go b/commands/pwd.go index fb1d04f1..e60326e5 100644 --- a/commands/pwd.go +++ b/commands/pwd.go @@ -13,6 +13,10 @@ func init() { Register(PrintWorkDir{}) } +func (PrintWorkDir) Description() string { + return "Display aerc's current working directory." +} + func (PrintWorkDir) Context() CommandContext { return GLOBAL } diff --git a/commands/quit.go b/commands/quit.go index e17200ef..8e828823 100644 --- a/commands/quit.go +++ b/commands/quit.go @@ -14,6 +14,10 @@ func init() { Register(Quit{}) } +func (Quit) Description() string { + return "Exit aerc." +} + func (Quit) Context() CommandContext { return GLOBAL } diff --git a/commands/redraw.go b/commands/redraw.go index b43e45e3..be25d5bd 100644 --- a/commands/redraw.go +++ b/commands/redraw.go @@ -8,6 +8,10 @@ func init() { Register(Redraw{}) } +func (Redraw) Description() string { + return "Force a full redraw of the screen." +} + func (Redraw) Context() CommandContext { return GLOBAL } diff --git a/commands/reload.go b/commands/reload.go index ecda1387..e09290c1 100644 --- a/commands/reload.go +++ b/commands/reload.go @@ -19,6 +19,10 @@ func init() { Register(Reload{}) } +func (Reload) Description() string { + return "Hot-reload configuration files." +} + func (r *Reload) CompleteStyle(s string) []string { var files []string for _, dir := range config.Ui.StyleSetDirs { diff --git a/commands/send-keys.go b/commands/send-keys.go index a61bfcf2..a49f4f1c 100644 --- a/commands/send-keys.go +++ b/commands/send-keys.go @@ -15,6 +15,10 @@ func init() { Register(SendKeys{}) } +func (SendKeys) Description() string { + return "Send keystrokes to the currently visible terminal." +} + func (SendKeys) Context() CommandContext { return GLOBAL } diff --git a/commands/suspend.go b/commands/suspend.go index 52198774..dc2d6b5a 100644 --- a/commands/suspend.go +++ b/commands/suspend.go @@ -8,6 +8,10 @@ func init() { Register(Suspend{}) } +func (Suspend) Description() string { + return "Suspend the aerc process." +} + func (Suspend) Context() CommandContext { return GLOBAL } diff --git a/commands/term.go b/commands/term.go index e8b1919d..e10f3e65 100644 --- a/commands/term.go +++ b/commands/term.go @@ -18,6 +18,10 @@ func init() { Register(Term{}) } +func (Term) Description() string { + return "Open a new terminal tab." +} + func (Term) Context() CommandContext { return GLOBAL } diff --git a/commands/z.go b/commands/z.go index ef26ae9c..493e36ff 100644 --- a/commands/z.go +++ b/commands/z.go @@ -34,6 +34,10 @@ func init() { } } +func (Zoxide) Description() string { + return "Change aerc's current working directory using zoxide." +} + func (Zoxide) Context() CommandContext { return GLOBAL } -- cgit