Skip to content

Instantly share code, notes, and snippets.

@sandervd
Created December 18, 2015 12:58
Show Gist options
  • Save sandervd/c3b10dd2df19a403e924 to your computer and use it in GitHub Desktop.
Save sandervd/c3b10dd2df19a403e924 to your computer and use it in GitHub Desktop.
drush() {
local git_root in_git local_drush
git_root=`git rev-parse --show-cdup 2>/dev/null`
in_git=$?
if [ $in_git = 0 ]; then
local_drush=$git_root"vendor/bin/drush"
if [ -e $local_drush ]; then
command $local_drush "$@"
return "$?"
fi
fi
command drush "$@"
}
@michiellucas
Copy link

Nice !

@kimkennof-dp
Copy link

Can we make this without the git lookup? just traverse paths upwards?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment