Skip to content

Instantly share code, notes, and snippets.

@Nemo64
Created June 26, 2014 15:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nemo64/4dd20d5a92f95388f0be to your computer and use it in GitHub Desktop.
Save Nemo64/4dd20d5a92f95388f0be to your computer and use it in GitHub Desktop.
Symfony app/console or bin/console shortcut to the simple letter "c". It also allows for autocompletion.
#!/bin/bash
CONSOLE_BIN=`symfony_console_binary`
if [ $CONSOLE_BIN ]
then
$CONSOLE_BIN $*
else
echo "no console binary found"
fi
#!/bin/bash
# autocompletion
# reference this file in your .bashrc
# source c.bash
_c()
{
local CACHE_FILE=".symfony-autocomplete"
local CONSOLE_BINARY=`symfony_console_binary`
if [ $CONSOLE_BINARY ]
then
local cur
_get_comp_words_by_ref -n : cur
local words
if [ -f $CACHE_FILE ]
then words=`cat $CACHE_FILE`
else words=`$CONSOLE_BINARY | grep -o -P "^ [\\w:]+" | tee $CACHE_FILE`
fi
COMPREPLY=( $(compgen -W "$words" -- $cur) )
__ltrim_colon_completions "$cur"
fi
}
complete -F _c c
#!/bin/bash
if [ -f app/console ]
then
echo app/console
else if [ -f bin/console ]
then
echo bin/console
else
exit 1
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment