My urfave/cli version is
v3.6.1
Checklist
Dependency Management
- My project is using go modules.
Describe the bug
When passing in uncompleted flags (--XXX<TAB>), no auto-completion is available.
To reproduce
In a project with autocompletions enabled with command and arguments run:
$ command <TAB>
subcommand
$ command subcommand -<TAB>
--par1
--par2
--flag
$command subcommand --pa<TAB>
* empty
Underlying I see respectively begin passed to the binary:
--generate-shell-completion, returns list of commands
- --generate-shell-completion returns list of flags
--pa --generate-shell-completion, but this one is empty
Observed behavior
No autocompletions given
Expected behavior
Correctly complete autocompletion of partial flags
Additional context
I worked around this by using a bash wrapper around the command binary, which rewrites calls in this form command --XXX --generate-shell-completion to command - --generate-shell-completion, which seems to work for bash/zsh.
Even though the command returns all possible flags, it's completion suggestions are filtered to relevant completions only.
Want to fix this yourself?
We'd love to have more contributors on this project! If the fix for
this bug is easily explained and very small, feel free to create a
pull request for it.
Run go version and paste its output here
go version go1.25.3 darwin/arm64
Run go env and paste its output here
Rather not, but available upon requests. Very simple default goenv setup. Go version 1.24.4
My urfave/cli version is
v3.6.1
Checklist
Dependency Management
Describe the bug
When passing in uncompleted flags (
--XXX<TAB>), no auto-completion is available.To reproduce
In a project with autocompletions enabled with command and arguments run:
Underlying I see respectively begin passed to the binary:
--generate-shell-completion, returns list of commands- --generate-shell-completionreturns list of flags--pa --generate-shell-completion, but this one is emptyObserved behavior
No autocompletions given
Expected behavior
Correctly complete autocompletion of partial flags
Additional context
I worked around this by using a bash wrapper around the
commandbinary, which rewrites calls in this formcommand --XXX --generate-shell-completiontocommand - --generate-shell-completion, which seems to work for bash/zsh.Even though the command returns all possible flags, it's completion suggestions are filtered to relevant completions only.
Want to fix this yourself?
We'd love to have more contributors on this project! If the fix for
this bug is easily explained and very small, feel free to create a
pull request for it.
Run
go versionand paste its output hereRun
go envand paste its output here