Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stecman/composer-bash-completion-plugin
A hacky composer plugin to add bash completion without changing Composer code
https://github.com/stecman/composer-bash-completion-plugin
bash-completion completion composer composer-plugin tab-completion zsh-completion
Last synced: 10 days ago
JSON representation
A hacky composer plugin to add bash completion without changing Composer code
- Host: GitHub
- URL: https://github.com/stecman/composer-bash-completion-plugin
- Owner: stecman
- Created: 2014-08-15T02:03:12.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2023-09-29T20:43:46.000Z (about 1 year ago)
- Last Synced: 2024-10-13T02:14:15.776Z (24 days ago)
- Topics: bash-completion, completion, composer, composer-plugin, tab-completion, zsh-completion
- Language: PHP
- Size: 39.1 KB
- Stars: 79
- Watchers: 6
- Forks: 8
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# BASH/ZSH auto-complete plugin for Composer
This is an experimental hack to add [Symfony BASH auto complete](https://github.com/stecman/symfony-console-completion) to Composer via a plugin. It's a pretty slimy hack, but it works without editing Composer's code.
![Composer BASH completion](https://i.imgur.com/MoDWkby.gif)
## Installation
1. Install the plugin:
```
composer global require stecman/composer-bash-completion-plugin dev-master
```2. Generate code to register a completion hook for your shell and Composer configuration:
```
source $(composer config home --global)/vendor/stecman/composer-bash-completion-plugin/generate-hook
```3. Add the registration code to your shell profile:
- If you're using BASH, copy the output to your `~/.bash_profile`
- If you're using ZSH, copy the output to your `~/.zshrc`4. Reload your modified shell config (or open a new shell), and enjoy tab completion on Composer
## Explanation
This hacky plugin injects an additional command into the Composer application at runtime. When the plugin in this package is activated and the command line starts with `composer depends _completion`, the plugin effectively reboots the application with the completion command added, and drops `depends` from the command line so that `_completion` becomes the command argument. This used to work without piggy-backing on a command, but an update to composer stopped the original method working (#8).