aboutsummaryrefslogtreecommitdiffstats
path: root/commands/compose/postpone.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/postpone.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/postpone.go')
-rw-r--r--commands/compose/postpone.go18
1 files changed, 3 insertions, 15 deletions
diff --git a/commands/compose/postpone.go b/commands/compose/postpone.go
index 767e759c..3ce9cc84 100644
--- a/commands/compose/postpone.go
+++ b/commands/compose/postpone.go
@@ -14,7 +14,7 @@ import (
)
type Postpone struct {
- Folder string `opt:"-t"`
+ Folder string `opt:"-t" complete:"CompleteFolder"`
}
func init() {
@@ -25,20 +25,8 @@ func (Postpone) Aliases() []string {
return []string{"postpone"}
}
-func (Postpone) Options() string {
- return "t:"
-}
-
-func (Postpone) CompleteOption(r rune, arg string) []string {
- var valid []string
- if r == 't' {
- valid = commands.GetFolders([]string{arg})
- }
- return commands.CompletionFromList(valid, []string{arg})
-}
-
-func (Postpone) Complete(args []string) []string {
- return nil
+func (*Postpone) CompleteFolder(arg string) []string {
+ return commands.GetFolders(arg)
}
func (p Postpone) Execute(args []string) error {