Git Product home page Git Product logo

knpconsoleautocompletebundle's Introduction

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:

knpconsoleautocompletebundle's People

Contributors

bobthecow avatar cordoval avatar gimler avatar havvg avatar l3pp4rd avatar lwagner avatar mbontemps avatar stfalcon avatar stloyd 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

Watchers

 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

knpconsoleautocompletebundle's Issues

Composer package version

It will be cool to have some explicit version of this bundle to use with composer. I mean may be it's time to create some 1.0.0 tag.

Default to normal completion

Hi there,

I love this innovative bundle, thank you!

One thing though that I didn't like about the autocomplete though, is that once you started to autocomplete with files/directories, it wouldn't end the autocomplete with a forward slash, but rather with a space. This made if very difficult to autocomplete down a directory tree.

http://www.debian-administration.org/articles/317#comment_16

You can actually accomplish default autocompletion very easily. Just change your complete command from the above comment at the end of the bash script. You also need to "return 1" like so:

    if [[ ${COMP_CWORD} > 1 ]] ; then
        case "${cur}" in
            --*)
                COMPREPLY=( $(compgen -W "$(${cmd} autocomplete ${COMP_WORDS[1]})" -- ${cur}) )
                return 0
                ;;
            *)
                return 1
                ;;
        esac
    fi

does not work on ubuntu debian

trying to get it to work on ubuntu debian but couldn't

it sounds like the script changed things on my terminal but everytime I hit tab it just goes a tab rather than autocompleting
this was not the normal behavior before, since ubunt has an autocomplete too... wonder if they are interfering and how to solve it...

When i run the command manually I get this :

cordoval@ms:~/sites-2/handy$ php app/console console:autocomple
help list cache:warmup router:debug cache:clear assets:install router:dump-apache container:debug init:acl swiftmailer:spool:send doctrine:mapping:info doctrine:mapping:import doctrine:generate:entities generate:doctrine:entities doctrine:database:drop doctrine:cache:clear-query doctrine:schema:update doctrine:schema:create doctrine:schema:drop doctrine:query:sql doctrine:cache:clear-metadata doctrine:ensure-production-settings doctrine:mapping:convert doctrine:query:dql doctrine:cache:clear-result doctrine:database:create assetic:dump doctrine:fixtures:load sonata:admin:explain sonata:admin:list sonata:admin:setup-acl fos:user:deactivate fos:user:change-password fos:user:promote fos:user:activate fos:user:create fos:user:demote console:autocomplete booking:setup doctrine:generate:crud generate:doctrine:crud doctrine:generate:entity generate:doctrine:entity generate:bundle doctrine:generate:form generate:

just read this:

The console:autocomplete will provide autocompletion facilities for shells.
For the moment, it just conveniently lists all commands in a shell friendly format.

after doing this ln -s app/console console

I get ./console doc[TAB] autocompletion to doctrine: but that is it, then nothing more, it behaves strange...

so now it is doing some autocomplete however the command filled in does not show up or it outputs strange characters

wow, could it be a problem with ubuntu autocompletes? http://translate.google.com/translate?js=n&prev=_t&hl=en&ie=UTF-8&layout=2&eotf=1&sl=ru&tl=en&u=http%3A%2F%2Fzendframework.ru%2Fforum%2Findex.php%3Ftopic%3D4411.0&act=url

similar behavior for autocompleting is reported:
i meant similar behavior is reported on Mac OS too

"so it looks like it's tabbing, even though I didn't see the change"

text does not change or is output wrongly and so autocomplete is not noticed

console command names should support underscore rather than dash

haven't used the bundle yet, but from the docs using dash as a separator in the console commands seems like a somewhat un-Symfony2 choice where underscores are preferred for this (see the sandbox). also i wonder if it will work if i put the console script in a non standard location like app/main/console?

then again i should probably just try this out and figure it out myself and send a pull .. oh time how i could use more of you :)

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.