aboutsummaryrefslogtreecommitdiffstats
path: root/commands/commands.go
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2023-11-24 16:03:00 +0100
committerRobin Jarry <robin@jarry.cc>2023-12-30 15:42:09 +0100
commit07c1cefcf62dbd094b6f97061c469264ee089898 (patch)
treed4e5469a2365f1589031e6cc9294c61ecd315276 /commands/commands.go
parentbb4db4ea65c0776f3088709e6dc2510612445226 (diff)
downloadaerc-07c1cefcf62dbd094b6f97061c469264ee089898.tar.gz
patch: create sub-command structure
Create the sub-command structure for the :patch command. Make the :patch command accessible from any context. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'commands/commands.go')
-rw-r--r--commands/commands.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/commands/commands.go b/commands/commands.go
index 2893aa82..3270bee6 100644
--- a/commands/commands.go
+++ b/commands/commands.go
@@ -185,7 +185,12 @@ func GetCompletions(
) (options []string, prefix string) {
// copy zeroed struct
tmp := reflect.New(reflect.TypeOf(cmd)).Interface().(Command)
- spec := opt.NewCmdSpec(args.Arg(0), tmp)
+ s, err := args.ArgSafe(0)
+ if err != nil {
+ log.Errorf("completions error: %v", err)
+ return options, prefix
+ }
+ spec := opt.NewCmdSpec(s, tmp)
return spec.GetCompletions(args)
}