aboutsummaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2024-06-23 22:49:35 +0200
committerRobin Jarry <robin@jarry.cc>2024-06-25 00:29:51 +0200
commit9cd806fa6e80829753ecd3356e19044d6e210826 (patch)
tree23360978b1ba0cb0e9dc2bfd7bc9b9c51ceba96f /commands
parent37ddad48770fe5e2f98c03bfc4692a59cd6d4a16 (diff)
downloadaerc-9cd806fa6e80829753ecd3356e19044d6e210826.tar.gz
cc,bcc,forward: add completion from address book
Allow using the address book for completion in the :cc, :bcc and :forward commands. Changelog-added: The address book is now used for `:cc`, `:bcc` and `:forward`. Requested-by: Maximilian Bosch <maximilian@mbosch.me> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Tested-by: Maximilian Bosch <maximilian@mbosch.me>
Diffstat (limited to 'commands')
-rw-r--r--commands/compose/cc-bcc.go6
-rw-r--r--commands/msg/forward.go6
2 files changed, 10 insertions, 2 deletions
diff --git a/commands/compose/cc-bcc.go b/commands/compose/cc-bcc.go
index d54a9895..92f792f1 100644
--- a/commands/compose/cc-bcc.go
+++ b/commands/compose/cc-bcc.go
@@ -6,7 +6,7 @@ import (
)
type CC struct {
- Recipients string `opt:"recipients"`
+ Recipients string `opt:"recipients" complete:"CompleteAddress"`
}
func init() {
@@ -21,6 +21,10 @@ func (CC) Aliases() []string {
return []string{"cc", "bcc"}
}
+func (*CC) CompleteAddress(arg string) []string {
+ return commands.GetAddress(arg)
+}
+
func (c CC) Execute(args []string) error {
composer, _ := app.SelectedTabContent().(*app.Composer)
diff --git a/commands/msg/forward.go b/commands/msg/forward.go
index ff5dbde7..2f108e8e 100644
--- a/commands/msg/forward.go
+++ b/commands/msg/forward.go
@@ -30,7 +30,7 @@ type forward struct {
Edit bool `opt:"-e"`
NoEdit bool `opt:"-E"`
Template string `opt:"-T" complete:"CompleteTemplate"`
- To []string `opt:"..." required:"false"`
+ To []string `opt:"..." required:"false" complete:"CompleteTo"`
}
func init() {
@@ -49,6 +49,10 @@ func (*forward) CompleteTemplate(arg string) []string {
return commands.GetTemplates(arg)
}
+func (*forward) CompleteTo(arg string) []string {
+ return commands.GetAddress(arg)
+}
+
func (f forward) Execute(args []string) error {
if f.AttachAll && f.AttachFull {
return errors.New("Options -A and -F are mutually exclusive")