Coder Social home page Coder Social logo

stecman / composer-bash-completion-plugin Goto Github PK

View Code? Open in Web Editor NEW
79.0 5.0 8.0 40 KB

A hacky composer plugin to add bash completion without changing Composer code

PHP 100.00%
completion tab-completion bash-completion zsh-completion composer composer-plugin

composer-bash-completion-plugin's People

Contributors

glensc avatar przepompownia avatar renepenner avatar stecman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

composer-bash-completion-plugin's Issues

Autocomplete custom scripts

To get list of custom scripts:

composer run-script -l

Or some php -r 'var_dump(array_keys(json_decode(file_get_contents("composer.json"), true)["scripts"]));'

Symfony Package Conflicts

Thanks for enabling Composer 2 support so quickly. However, now I'm getting conflicts with other packages due to the required symfony/console version.

$ composer global require stecman/composer-bash-completion-plugin dev-master
Changed current directory to /home/chris/.config/composer
./composer.json has been updated
Running composer update stecman/composer-bash-completion-plugin
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - stecman/symfony-console-completion 0.7.0 requires symfony/console ~2.3 || ~3.0 -> found symfony/console[v2.3.0, ..., v2.8.52, v3.0.0, ..., v3.4.45] but the package is fixed to v5.1.7 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - stecman/composer-bash-completion-plugin dev-master requires stecman/symfony-console-completion ~0.7.0 -> satisfiable by stecman/symfony-console-completion[0.7.0].
    - Root composer.json requires stecman/composer-bash-completion-plugin dev-master -> satisfiable by stecman/composer-bash-completion-plugin[dev-master].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

I believe this is due to the "stecman/symfony-console-completion": "~0.7.0" dependency. It looks like you have an updated version that supports newer Symfony package versions though. I'm not sure but updating this dependency might be all you need to do to fix that.

[Feature] Provide ready to use bash/zsh files to download.

It would be nice to have the zsh and bash completion snippets in distinct files.

Along with the possibility to directly download these and copy/symlink them to:

/usr/local/share/zsh/site-functions      # zsh
/usr/share/bash-completion/completions/  # bash

Further it would make it easier to send pull requests with improvements.

Composer 2 Support

Composer 2 was just released and this plugin doesn't seem to be compatible. When running composoer global update I'm seeing the following output

$ composer global update
Changed current directory to /home/chris/.config/composer
The "stecman/composer-bash-completion-plugin" plugin was skipped because it requires a Plugin API version ("^1.0") that does not match your Composer installation ("2.0.0"). You may need to run composer update with the "--no-plugins" option.
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires stecman/composer-bash-completion-plugin dev-master -> satisfiable by stecman/composer-bash-completion-plugin[dev-master].
    - stecman/composer-bash-completion-plugin dev-master requires composer-plugin-api ^1.0 -> found composer-plugin-api[2.0.0] but it does not match the constraint.

You are using Composer 2, which some of your plugins seem to be incompatible with. Make sure you update your plugins or report a plugin-issue to ask them to support Composer 2.

Also, when attempting to tab complete something the following is printed to the terminal

The "stecman/composer-bash-completion-plugin" plugin was skipped because it requires a Plugin API version ("^1.0") that does not match your Composer installation ("2.0.0"). You may need to run composer update with the "--no-plugins" option.

                                                        
  [InvalidArgumentException]                            
  Could not find package "_completion" in your project  
                                                        

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

[Feature] Complete packages after require statement

Hey Stephen,
first of all ... let me thank you for that awesome plugin. The idea of fetching valid suggestions from the available *Commands and InputOptions is brilliant and logical.

I've seen other completion functions capable of providing completions for the require command by using a (cached) result of composer show.

composer show -a | grep -v '^No composer' 

... can be used to find all available packages without the line ...

No composer.json found in the current directory, showing available packages from packagist

... if composer is executed inside a directory that has no composer.json.

I didn't have the time to dive into the code of the CompletionCommand yet.

Would you rather add something like this in the bash/zsh-snippets or do this in PHP with a ComposerCompletionCommand that extends CompletionCommand added to this repository?

[Feature] Complete currently required packages with composer {update,remove}

It would be nice to complete composer remove and composer update with the resultset of:

composer <global> show --self --no-ansi

This is the list of local requires along with some other information. An example command to find all requires and requires (dev) in the output would be:

composer global show --self --no-ansi \
| sed -n '/^requires\(\s(.*)\)*$/d' -e '/^$/,$p' \
| sed -e '/^requires\(\s(.*)\)*$/d' -e '/^$/d' \
| awk '{print $1;}'

This:

  • prints from the first occuring line that is "requires" or "requires"
  • then removes the all lines matching this pattern
  • then removes all empty lines
  • then (awk) removes the second column (version contraints).

Pretty sure it can be improved but it works flawlessly throughout all test-runs i made (only requires, only dev-requires, ...).

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

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

Conflict with symfony/console 3.2

Please try, for example,

composer global require stecman/composer-bash-completion-plugin dev-master
composer global require ovr/phpsa

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.