Developed with love by KnpLabs Hire us for your project!
49

KnpConsoleAutocompleteBundle

by KnpLabs

This Symfony2 bundle provides a simple way of autocompleting your commands in your shell. -- THIS PROJECT IS NO LONGER MAINTAINED by KnpLabs -- Contact...

THIS PROJECT IS NO LONGER MAINTAINED by KnpLabs

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:

  1. Download KnpConsoleAutocompleteBundle
  2. Configure the Autoloader
  3. Enable the Bundle
  4. 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:

Copyright (C) 2011 by KnpLabs <http://www.KnpLabs.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
  • Added message: THIS PROJECT IS NO LONGER MAINTAINED by KnpLabs
    By evey, 5 years ago
  • Merge pull request #17 from stfalcon/patch-1
    By mbontemps, 5 years ago
  • Default to normal completion
    By stfalcon, 5 years ago
  • fix typo in composer.json
    By l3pp4rd, 5 years ago
  • Merge pull request #12 from KnpLabs/composer
    By l3pp4rd, 5 years ago
  • Add composer.json
    By stloyd, 5 years ago
  • Merge pull request #14 from gimler/patch-1
    By mbontemps, 5 years ago
  • rewrite README base on FOSUserBundle
    By gimler, 5 years ago
  • Merge pull request #13 from havvg/patch-1
    By mbontemps, 5 years ago
  • fix git submodule url
    By havvg, 5 years ago
  • Fix repo url
    By lwagner, 5 years ago
  • Merge pull request #9 from cordoval/ReadmeUpdate
    By mbontemps, 6 years ago
  • updated readme to support deps
    By cordoval, 6 years ago
  • Change Knplabs to Knp. BC break before Symfony2 release.
    By mbontemps, 6 years ago
  • Update to latest Symfony
    By mbontemps, 6 years ago
  • Remove old console names
    By mbontemps, 6 years ago
  • Update KnpLabs spelling
    By mbontemps, 6 years ago
  • Update to the latest symfony
    By mbontemps, 6 years ago
  • Update to the latest bundle naming convention
    By mbontemps, 6 years ago
  • Add instructions for alternate executable names.
    By bobthecow, 6 years ago
  • Add instructions to autocomplete options. This requires a resourcing of your current symfony2-completion.bash file
    By mbontemps, 6 years ago
  • Add credits to Justin and a license
    By mbontemps, 6 years ago
  • Refactor autocompletion to simplify understanding
    By mbontemps, 6 years ago
  • Merge branch 'autocomplete-options' of https://github.com/bobthecow/ConsoleAutocompleteBundle into bobthecow-autocomplete-options
    By mbontemps, 6 years ago
  • Revert a part of the previous changes to add the "Bundle/" namespace before the vendor namespace.
    By mbontemps, 6 years ago
  • Add autocomplete for console command options.
    By bobthecow, 6 years ago
  • Update bundle name and namespace to (new) best practices.
    By bobthecow, 6 years ago
  • Use Knplabs namespace to follow best practices
    By mbontemps, 6 years ago
  • Add several valid executable names
    By mbontemps, 6 years ago
  • latest symfony2 API does not have getCommands() method
    By olegstepura, 6 years ago