Last active
September 1, 2016 08:16
-
-
Save henkealg/fc09df86f780fa39a68faa71affec724 to your computer and use it in GitHub Desktop.
Global shortcut shell script for faster access to vagrant boxes through the (pref. MacOS) terminal
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
#!/bin/bash | |
match=0 | |
project=${1-none} | |
action=${2-up} | |
# --- place this script in the /usr/local/bin foder with permissions -rwxrwxrwx | |
# --- only strings in CAPITAL LETTERS below should be edited | |
# --- update the path variable to point to your local project folder root, ending without slash | |
# --- example: /User/henkealg/Documents/web_projects | |
path="PATH_TO_LOCAL_PROJECT_FOLDER" | |
# ---- leave the 4 lines below unchanged | |
if [ $project == "list" ]; then | |
match=1 | |
cd $path | |
action="list" | |
# ---- duplicate the three lines below to add a new project reference, adjustingthe CAPITAL LETTER strings only | |
elif [ $project == "PROJECT_NAME" ]; then | |
match=1; | |
cd $path"/PATH_TO_PROJECT_VAGRANT_FOLDER/" | |
# ---- do not edit below this line --- | |
else | |
echo "Oups! Seems you forgot to enter a valid project. use vg PROJECT ACTION or list vm:s by vg list" | |
fi | |
if [ $match -eq 1 ]; then | |
vagrant $action | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment