v1 bug: Panic when printing completions #1093
Labels
area/v1
relates to / is being considered for v1
help wanted
please help if you can!
kind/bug
describes or fixes a bug
status/confirmed
confirmed to be valid, but work has yet to start
my urfave/cli version is
v1.22.2, v1.22.3
Checklist
Dependency Management
Describe the bug
I'm experiencing panic when trying to print bash completions for partially completed flag
cmd subcmd --abc[TAB]
.To reproduce
example cmd --abc[TAB]
Observed behavior
Panic
Expected behavior
No panic. I also would expect that I will get completions for the flag:
Additional context
cli/command.go
Lines 117 to 125 in c354cec
Code here looks very suspicious. If we have
err
returned inc.parseFlags
thenset
will benil
andcheckCommandCompletions
will accessctx
which hasctx.flagSet == nil
. This means that any calls inside thecheckCommandCompletions
accessingflagSet
will panic (like.NArg()
).There was also similar issue for the
v2
: #944. It would be nice to have that fix backported to thev1
as well.Run
go version
and paste its output hereThe text was updated successfully, but these errors were encountered: