aboutsummaryrefslogtreecommitdiffstats
path: root/commands/compose/detach.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-10-22 23:23:18 +0200
committerRobin Jarry <robin@jarry.cc>2023-10-28 19:25:10 +0200
commitabe228b14d97d8d47e8ff4406de387fac45cfe68 (patch)
tree56117403d1ae32d7253f86bab01a944a3cf225b9 /commands/compose/detach.go
parent30851656591293ed2e19340ab78c937855a11143 (diff)
downloadaerc-abe228b14d97d8d47e8ff4406de387fac45cfe68.tar.gz
commands: use completion from go-opt
Implement command completion with complete struct field tags from the get-opt library introduced earlier. Changelog-changed: Improved command completion. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
Diffstat (limited to 'commands/compose/detach.go')
-rw-r--r--commands/compose/detach.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/commands/compose/detach.go b/commands/compose/detach.go
index a2996516..91cf2a58 100644
--- a/commands/compose/detach.go
+++ b/commands/compose/detach.go
@@ -4,10 +4,11 @@ import (
"fmt"
"git.sr.ht/~rjarry/aerc/app"
+ "git.sr.ht/~rjarry/aerc/commands"
)
type Detach struct {
- Path string `opt:"path" required:"false"`
+ Path string `opt:"path" required:"false" complete:"CompletePath"`
}
func init() {
@@ -18,9 +19,9 @@ func (Detach) Aliases() []string {
return []string{"detach"}
}
-func (Detach) Complete(args []string) []string {
+func (*Detach) CompletePath(arg string) []string {
composer, _ := app.SelectedTabContent().(*app.Composer)
- return composer.GetAttachments()
+ return commands.CompletionFromList(composer.GetAttachments(), arg)
}
func (d Detach) Execute(args []string) error {