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/account/export-mbox.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'commands/account/export-mbox.go') diff --git a/commands/account/export-mbox.go b/commands/account/export-mbox.go index 00e03ca6..14d9290e 100644 --- a/commands/account/export-mbox.go +++ b/commands/account/export-mbox.go @@ -17,7 +17,7 @@ import ( ) type ExportMbox struct { - Filename string `opt:"filename"` + Filename string `opt:"filename" complete:"CompleteFilename"` } func init() { @@ -28,8 +28,8 @@ func (ExportMbox) Aliases() []string { return []string{"export-mbox"} } -func (ExportMbox) Complete(args []string) []string { - return commands.CompletePath(filepath.Join(args...)) +func (*ExportMbox) CompleteFilename(arg string) []string { + return commands.CompletePath(arg) } func (e ExportMbox) Execute(args []string) error { -- cgit