Skip to content

Instantly share code, notes, and snippets.

@mboynes
Created October 28, 2014 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mboynes/97b0b36ced5bc0458910 to your computer and use it in GitHub Desktop.
Save mboynes/97b0b36ced5bc0458910 to your computer and use it in GitHub Desktop.
wp wrapper for vagrant
#!/bin/bash
ARGS="$@"
DIR=`pwd 2>&1`
if [[ $DIR == *www* ]]; then
if [[ $ARGS != *--url* ]]; then
SITE=`pwd | sed 's/.*\/www\///' | cut -d "/" -f 1 2>&1`
if [[ $SITE == "wordpress" ]]; then
ARGS="$ARGS --url=wp.dev"
elif [[ $SITE == "trunk" ]]; then
ARGS="$ARGS --url=trunk.dev"
elif [[ $SITE != "" ]]; then
ARGS="$ARGS --url=$SITE.alley.dev"
fi
fi
DIR=`pwd | sed 's/.*\/www\//\/var\/www\//' 2>&1`
else
if [[ $ARGS != *--url* ]]; then
THEME=`pwd | sed 's/.*\/themes\/\(vip\/\)*//' | cut -d "/" -f 1 2>&1`
if [[ $THEME != "" ]]; then
ARGS="$ARGS --url=$THEME.wp.dev"
else
ARGS="$ARGS --url=wp.dev"
fi
fi
DIR="/var/www/wordpress/"
fi
echo "cd $DIR; wp $ARGS"
vagrant ssh -c "cd $DIR; wp $ARGS"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment