aboutsummaryrefslogtreecommitdiffstats
path: root/commands/compose/send.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2024-10-12 00:21:44 +0200
committerRobin Jarry <robin@jarry.cc>2024-10-23 10:22:51 +0200
commit3c9ad93801ce9bb71d76fa398d7d94f1afd2c2cb (patch)
treedcc715e090fedf65e2b0f800d4d969b4606f7a5c /commands/compose/send.go
parent63db443949b92eed5f5d2ded5f430bda96312b43 (diff)
downloadaerc-3c9ad93801ce9bb71d76fa398d7d94f1afd2c2cb.tar.gz
completion: display descriptions next to choices
Use go-opt v2 new completion API which returns items descriptions along with their text values. Display the descriptions after the items separated by two spaces. Wrap the descriptions in parentheses to better indicate that they are not part of the completion choices. Limit the description length to 80 characters to avoid display issues. Add a new style object completion_description in stylesets. By default, the object will be rendered with a dimmed terminal attribute. Update all stylesets and documentation accordingly. Implements: https://todo.sr.ht/~rjarry/aerc/271 Link: https://git.sr.ht/~rjarry/go-opt/commit/ebeb82538395a Changelog-added: Command completion now displays descriptions next to completion items. Changelog-added: New `completion_description` style object in style sets used for rendering completion item descriptions. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bojan Gabric <bojan@bojangabric.com> Tested-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
Diffstat (limited to 'commands/compose/send.go')
-rw-r--r--commands/compose/send.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/commands/compose/send.go b/commands/compose/send.go
index aefeaa3c..1e30bd0e 100644
--- a/commands/compose/send.go
+++ b/commands/compose/send.go
@@ -19,6 +19,7 @@ import (
"git.sr.ht/~rjarry/aerc/lib/send"
"git.sr.ht/~rjarry/aerc/models"
"git.sr.ht/~rjarry/aerc/worker/types"
+ "git.sr.ht/~rjarry/go-opt/v2"
"github.com/emersion/go-message/mail"
)
@@ -142,12 +143,13 @@ func (s Send) Execute(args []string) error {
from, rcpts, tab.Name, s.CopyTo,
s.Archive, copyToReplied)
}
- }, func(cmd string) ([]string, string) {
+ }, func(cmd string) ([]opt.Completion, string) {
+ var comps []opt.Completion
if cmd == "" {
- return []string{"y", "n"}, ""
+ comps = append(comps, opt.Completion{Value: "y"})
+ comps = append(comps, opt.Completion{Value: "n"})
}
-
- return nil, ""
+ return comps, ""
},
)