stecman / composer-bash-completion-plugin

A hacky composer plugin to add bash completion without changing Composer code
79 stars 8 forks source link

The "--shell-type" option does not exist #22

Closed PHLAK closed 2 years ago

PHLAK commented 3 years ago

I've been seeing the following error lately when I'd expect to see completion results.

$ composer <Tab> <Tab> 

  [Symfony\Component\Console\Exception\RuntimeException]  
  The "--shell-type" option does not exist.               

depends [-r|--recursive] [-t|--tree] [--] <package>

Running Arch Linux.

$ php --version
PHP 8.0.10 (cli) (built: Aug 26 2021 10:26:33) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.10, Copyright (c) Zend Technologies
    with Xdebug v3.0.4, Copyright (c) 2002-2021, by Derick Rethans
$ composer global show --direct
Changed current directory to /home/chris/.config/composer
beyondcode/expose                       2.0.2              Create public URLs for local sites through any firewall and VPN.
friendsofphp/php-cs-fixer               v3.1.0             A tool to automatically fix PHP code style
laravel/installer                       v4.2.8             Laravel application installer.
psy/psysh                               v0.10.8            An interactive shell for modern PHP.
squizlabs/php_codesniffer               3.6.0              PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a...
stecman/composer-bash-completion-plugin dev-master 14b1ef5 BASH/ZSH auto-complete plugin for Composer
spalekg commented 2 years ago

To remove this error and fix issue, edit your /home/chris/.config/composer/vendor/stecman/composer-bash-completion-plugin/hooks/bash-completion file and change line 24 to looks like this: RESULT="$(cd "$_composer_config_dir" && $composer depends _completion </dev/null)";

PS: This should be fixed on the master branch by the owner too

Thanks.

stecman commented 2 years ago

Thanks guys - the order of parsing and plugin loading had changed in Composer. I've changed the way options are passed through in the hooks to fix this. Update this package and reload your shell profile / hook :+1: