stecman / symfony-console-completion

Automatic tab-key completion for Symfony console application options, arguments and parameters
MIT License
420 stars 26 forks source link

Specifiying global option immediately after console name prevents specific long options for arguments from completing #83

Closed danemacmillan closed 5 years ago

danemacmillan commented 6 years ago

My console tool has several global options, such as the defaults like --ansi or --help, and some of my custom arguments have their own specific options that are only available to them.

I've noticed that if I specify a global option immediately after the console tool name, linus in this case, and then attempt to get tab completion for an option against the argument name that follows, the completion suggestions only include the global ones, and ignore the specific ones specific to the argument name. However, if I move the global option after the argument name, I get tab completion for all possible options, both global, and more importantly, the specific ones that are available to the argument name.

See the following output as an example of the difference between the completion suggestions when a global option is passed immediately after the console tool name, and then when a global option is passed immediately after the argument name:

danemacmillan@macmillanator.local ~ $ linus -v deploy:update --
--ansi                    --load-config             --no-cleanup              --quiet                   --save-config-all         --verbose
--help                    --no-ansi                 --no-interaction          --save-config             --save-config-before-run  --version
danemacmillan@macmillanator.local ~ $ linus deploy:update -v --
--ansi                    --load-config             --no-ansi                 --no-integrity-check      --quiet                   --save-config-all         --verbose
--help                    --merge-develop           --no-cleanup              --no-interaction          --save-config             --save-config-before-run  --version

Notice that in the first ouput I'm not provided a suggestion to use the --merge-develop or --no-integrity-check options, and only see the global options, while in the second output, I see all the global options as well as the specific options for the given argument name.

Has anyone else noticed this?

danemacmillan commented 5 years ago

Thanks!