guumaster
3/14/2013 - 7:51 PM

Symfony command line shortcut.

Symfony command line shortcut.

Installation

  • copy sf.sh to somewhere in your $PATH.
  • rename to whatever you like to call your command, ie: mv sf.sh sf
  • give it execution permission. ex: chmod +x sf

Usage

Instead of using php app/console cache:clear use this:

$> sf cache:clear

#!/bin/bash
# Expand globs to null when there are no matches
shopt -s nullglob
# Look for either a ‘/console’ or a ‘symfony’ file
until
    file=(app/console symfony); [[ -f "$file" ]] && php "$file" "$@" && exit;
do
    [[ "$PWD" == "/" ]] && break;
    cd ..
done
echo "No Symfony file found!"