urfave / cli

A simple, fast, and fun package for building command line apps in Go
https://cli.urfave.org
MIT License
21.91k stars 1.69k forks source link

bug report: shell completion doesn't work with sub-commands v3-alpha4 #1814

Closed yogeshlonkar closed 7 months ago

yogeshlonkar commented 9 months ago

Checklist

What problem does this solve?

If fixed, shell completion of sub-commands should work same as v2. For example:

mycli sub1 --generate-shell-completion

Instead of calling/ completing sub1 command the cli executes the action of sub1.

The issue is here https://github.com/urfave/cli/blob/v3.0.0-alpha4/help.go#L448-L455.

Solution description

If the solution correct, I will try to provide a PR for this

dearchap commented 9 months ago

@yogeshlonkar This issue is present only in v3. If you look at v2 the shellComplete flag is set in context which is used to check later on. If you can add the flag back into context that would be great

dearchap commented 7 months ago

@yogeshlonkar try this fix and see if it helps