2017 © Pedro Peláez
 

library symfony-console-autocomplete

Shell completion for Symfony Console based scripts

image

bamarni/symfony-console-autocomplete

Shell completion for Symfony Console based scripts

  • Monday, May 21, 2018
  • by bamarni
  • Repository
  • 8 Watchers
  • 281 Stars
  • 34,795 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 17 Forks
  • 1 Open issues
  • 18 Versions
  • 10 % Grown

The README.md

Symfony console autocomplete

GitHub CI Status GitHub Issues Build Status, (*1)

PHP Version Stable Version, (*2)

Total Downloads Monthly Downloads Daily Downloads Packagist Stars, (*3)

Enables shell autocompletion for tools based on the Symfony Console (Symfony framework, Composer, PHPSpec, Behat, etc.), (*4)

screenshot of symfony-console-autocomplete in action: zsh autocompletion for composer (press tab two times), (*5)

Prerequisites

  • Make sure the global composer project is configured properly with your shell. Notably, the composer global bin directory needs to be in your path. See https://getcomposer.org/doc/03-cli.md#global for instructions on how todo that.
  • If you're using bash, you'll have to make sure programmable completion functions are available. Linux distributions usually ship it and enable it by default. On Mac OSX, you can install it with brew (brew install bash-completion) and enable it by adding source $(brew --prefix)/etc/bash_completion at the end of your .bashrc.

Installation

Install the tool globally with Composer :, (*6)

composer global require bamarni/symfony-console-autocomplete

Quick setup

Add the following line at the end of your shell configuration file (~/.bash_profile or ~/.zshrc) :, (*7)

eval "$(symfony-autocomplete)"

Close / re-open your terminal window and you're ready to go!, (*8)

Note that quick setup only works for supported tools., (*9)

Static setup

If you don't like all the magic from the quick setup and want to go with a more standard way, you can dump a static completion file for a given tool :, (*10)

symfony-autocomplete composer

This will print the completion script for Composer to stdout. The output should be saved at a specific location depending on your OS / setup. Here are a few examples :, (*11)

# BASH - Ubuntu / Debian
symfony-autocomplete composer | sudo tee /etc/bash_completion.d/composer

# BASH - Mac OSX (with Homebrew "bash-completion")
symfony-autocomplete composer > $(brew --prefix)/etc/bash_completion.d/composer

# ZSH - Config file
symfony-autocomplete composer > ~/.composer_completion && echo "source ~/.composer_completion" >> ~/.zshrc

# FISH
symfony-autocomplete --shell=fish composer > ~/.config/fish/completions/composer.fish

If you are running an environment that does not have automatic execution of PHP scripts, then you will need to call PHP and the script in question :, (*12)

symfony-autocomplete "php ./artisan"

General tips

Update

To update the tool to a new version use :, (*13)

composer global update bamarni/symfony-console-autocomplete

Symfony framework completion

In order to get completion running, you shouldn't prepend php at the beginning of the command :, (*14)

app/console [TAB]

Tips for Bash users

Alias support

By default, completion for your aliases won't be enabled. If you're using aliases (e.g. "c" for "composer", "pspec" for "phpspec", etc.), you have to pass them explicitly :, (*15)

symfony-autocomplete --aliases=c --aliases=pspec

Tips for Docker users

Defining the SHELL environment variable

If you connect to your container using something similar to docker exec -it container bash then you may find that the completions cannot be built due to an inability to locate the SHELL environment variable. This has been reported in https://github.com/bamarni/symfony-console-autocomplete/issues/32, (*16)

A solution is to supply the SHELL environment variable as part of the docker exec command:, (*17)

docker exec -e SHELL=bash -it container bash

Supported tools

All tools using the Symfony Console component are supported., (*18)

However, quick setup only works if the entrypoint is named console or in the following list of tools:, (*19)

The Versions

21/05 2018

dev-master

9999999-dev

Shell completion for Symfony Console based scripts

  Sources   Download

MIT

The Requires

 

The Development Requires

by Richard Quadling
by Bilal Amarni

25/04 2018

v1.3.4

1.3.4.0

Shell completion for Symfony Console based scripts

  Sources   Download

MIT

The Requires

 

The Development Requires

by Richard Quadling
by Bilal Amarni

21/04 2018

v1.3.3

1.3.3.0

Shell completion for Symfony Console based scripts

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bilal Amarni

19/04 2018

v1.3.2

1.3.2.0

Shell completion for Symfony Console based scripts

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bilal Amarni

18/04 2018

v1.3.1

1.3.1.0

Shell completion for Symfony Console based scripts

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bilal Amarni

14/03 2018

v1.3.0

1.3.0.0

Shell completion for Symfony Console based scripts

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bilal Amarni

15/01 2017

dev-fish-support

dev-fish-support

Shell completion for Symfony Console based scripts

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bilal Amarni

14/02 2016

v1.2.0

1.2.0.0

Shell completion for Symfony Console based scripts

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bilal Amarni

25/01 2016

v1.1.3

1.1.3.0

Shell completion for Symfony Console based scripts

  Sources   Download

MIT

The Requires

 

by Bilal Amarni

20/01 2016

v1.1.2

1.1.2.0

Shell completion for Symfony Console based scripts

  Sources   Download

MIT

The Requires

 

by Bilal Amarni

16/01 2016

v1.1.1

1.1.1.0

Bash completion for Symfony Console based scripts

  Sources   Download

MIT

The Requires

 

by Bilal Amarni

10/01 2016

v1.1.0

1.1.0.0

Bash completion for Symfony Console based scripts

  Sources   Download

MIT

The Requires

 

by Bilal Amarni

23/12 2015

v1.0.5

1.0.5.0

Bash completion for Symfony Console based scripts

  Sources   Download

MIT

The Requires

 

by Bilal Amarni

18/12 2015

v1.0.4

1.0.4.0

Bash completion for Symfony Console based scripts

  Sources   Download

MIT

The Requires

 

by Bilal Amarni

14/12 2015

v1.0.3

1.0.3.0

Bash completion for Symfony Console based scripts

  Sources   Download

MIT

The Requires

 

by Bilal Amarni

13/12 2015

v1.0.2

1.0.2.0

Bash completion for Symfony Console based scripts

  Sources   Download

MIT

The Requires

 

by Bilal Amarni

13/12 2015

v1.0.1

1.0.1.0

Bash completion for Symfony Console based scripts

  Sources   Download

MIT

The Requires

 

by Bilal Amarni

13/12 2015

v1.0.0

1.0.0.0

Bash completion for Symfony Console based scripts

  Sources   Download

MIT

The Requires

 

by Bilal Amarni