Created
October 26, 2015 03:37
-
-
Save andrewwoods/cf71323b61dfb0de2fc4 to your computer and use it in GitHub Desktop.
VVV - Create corresponding path for your vagrant box
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I'm using VVV. Let's say I have a really long path like | |
# | |
# /Users/awoods/vagrant-local/www/project-site/public_html/wp-content/plugins/my-plugin | |
# | |
# If I 'vagrant ssh' into the host and want to cd to the corresponding path | |
# it's a pain to have to type in a really long path like | |
# | |
# /srv/www/project-site/public_html/wp-content/plugins/my-plugin | |
# | |
# This function gets your current path, and return the corresponding | |
# path for your virtual machine. You'll need to modify the regex to | |
# match your system. Once you do, it's very easy to use this function | |
# | |
# $ vvvpath | pbcopy | |
# | |
# which will copy the result path into your system pasteboard. | |
# Then just `vagrant ssh` to access the host and do | |
# | |
# $ cd CMD+v | |
# | |
function vvvpath | |
{ | |
host_path=`pwd` | |
# % is the delimiter here because the / is used in the path. | |
# looks cleaerner than escaping it | |
vvv_path=$( echo $host_path | sed 's%^/Users/awoods/vagrant\-local%/srv%' ) | |
echo $vvv_path | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment