diff options
author | Robin Jarry <robin@jarry.cc> | 2023-10-22 23:23:18 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-10-28 19:25:10 +0200 |
commit | abe228b14d97d8d47e8ff4406de387fac45cfe68 (patch) | |
tree | 56117403d1ae32d7253f86bab01a944a3cf225b9 /commands/account/compose.go | |
parent | 30851656591293ed2e19340ab78c937855a11143 (diff) | |
download | aerc-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/account/compose.go')
-rw-r--r-- | commands/account/compose.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/commands/account/compose.go b/commands/account/compose.go index 81eb3de0..fe86a179 100644 --- a/commands/account/compose.go +++ b/commands/account/compose.go @@ -11,12 +11,13 @@ import ( "github.com/emersion/go-message/mail" "git.sr.ht/~rjarry/aerc/app" + "git.sr.ht/~rjarry/aerc/commands" "git.sr.ht/~rjarry/aerc/config" ) type Compose struct { Headers string `opt:"-H" action:"ParseHeader"` - Template string `opt:"-T"` + Template string `opt:"-T" complete:"CompleteTemplate"` Edit bool `opt:"-e"` NoEdit bool `opt:"-E"` Body string `opt:"..." required:"false"` @@ -37,12 +38,12 @@ func (c *Compose) ParseHeader(arg string) error { return nil } -func (Compose) Aliases() []string { - return []string{"compose"} +func (*Compose) CompleteTemplate(arg string) []string { + return commands.GetTemplates(arg) } -func (Compose) Complete(args []string) []string { - return nil +func (Compose) Aliases() []string { + return []string{"compose"} } func (c Compose) Execute(args []string) error { |