knplabs / knp-console-autocomplete-bundle
This Symfony2 bundle provides a simple way of autocompleting your commands in your shell.
Installs: 34 851
Dependents: 0
Suggesters: 0
Security: 0
Stars: 38
Watchers: 29
Forks: 3
Open Issues: 2
Type:symfony-bundle
Requires
- php: >=5.3.2
- symfony/console: >=2.0.0
This package is not auto-updated.
Last update: 2020-01-24 15:02:26 UTC
README
Contact us if you want to be the official maintainer of this Bundle
ConsoleAutocompleteBundle
This bundle provides a simple way of autocompleting your commands in your shell.
Installation
Installation is a quick (I promise!) 4 step process:
- Download KnpConsoleAutocompleteBundle
- Configure the Autoloader
- Enable the Bundle
- Add profile shortcut
Step 1: Download KnpConsoleAutocompleteBundle
Ultimately, the KnpConsoleAutocompleteBundle files should be downloaded to the
vendor/bundles/Knp/Bundle/ConsoleAutocompleteBundle
directory.
This can be done in several ways, depending on your preference. The first method is the standard Symfony2 method.
Using the vendors script
Add the following lines in your deps
file:
[KnpConsoleAutocompleteBundle]
git=https://github.com/KnpLabs/KnpConsoleAutocompleteBundle.git
target=/bundles/Knp/Bundle/ConsoleAutocompleteBundle
Now, run the vendors script to download the bundle:
$ php bin/vendors install
Using submodules
If you prefer instead to use git submodules, then run the following:
$ git submodule add git://github.com/KnpLabs/KnpConsoleAutocompleteBundle.git vendor/bundles/Knp/Bundle/ConsoleAutocompleteBundle $ git submodule update --init
Step 2: Configure the Autoloader
Add the Knp
namespace to your autoloader:
<?php // app/autoload.php $loader->registerNamespaces(array( // ... 'Knp' => __DIR__.'/../vendor/bundles', ));
Step 3: Enable the bundle
Finally, enable the bundle in the kernel:
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Knp\Bundle\ConsoleAutocompleteBundle\KnpConsoleAutocompleteBundle(), ); }
Step 4: Add profile shortcut
The first time you install KnpConsoleAutocompleteBundle
in a project, you should add Resources/Shells/symfony2-completion.bash
in your bash profile (in ~/.bash_profile
on MacOS and ~/.bashrc
on Ubuntu Debian or other linux):
source /path-to-symfony2-completion.bash
Usage
That's it! Now when you type:
./app/console doc[TAB]
, you should see an autocompletion of the command name.
./app/console doctrine:fixtures:load --[TAB]
, you should see an autocompletion of the option names.
Valid executable names are:
console
Symfony
Troubleshooting
If none of these names do it for you, you can enable completion for your own executable. Add this line to your bash profile, just below where you sourced symfony2-completion.bash
:
complete -F _console my-console-name
Copyright & Credits
KnpConsoleAutocompleteBundle Copyright (c) 2011 KnpLabs.
See LICENSE for details.
Contributors: