From abe228b14d97d8d47e8ff4406de387fac45cfe68 Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Sun, 22 Oct 2023 23:23:18 +0200 Subject: 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 Reviewed-by: Koni Marti Tested-by: Moritz Poldrack Tested-by: Inwit --- commands/compose/header.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'commands/compose/header.go') diff --git a/commands/compose/header.go b/commands/compose/header.go index aaa14e43..afc27e92 100644 --- a/commands/compose/header.go +++ b/commands/compose/header.go @@ -11,7 +11,7 @@ import ( type Header struct { Force bool `opt:"-f"` Remove bool `opt:"-d"` - Name string `opt:"name"` + Name string `opt:"name" complete:"CompleteHeaders"` Value string `opt:"..." required:"false"` } @@ -37,8 +37,8 @@ func (Header) Options() string { return "fd" } -func (Header) Complete(args []string) []string { - return commands.CompletionFromList(headers, args) +func (*Header) CompleteHeaders(arg string) []string { + return commands.CompletionFromList(headers, arg) } func (h Header) Execute(args []string) error { -- cgit