aboutsummaryrefslogtreecommitdiffstats
path: root/commands/commands.go
diff options
context:
space:
mode:
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)
}