Created
February 18, 2012 06:13
-
-
Save asalant/1857778 to your computer and use it in GitHub Desktop.
Bash/zsh/... function for simpler heroku command line usage with multiple apps for the same project.
This file contains hidden or 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
| # Alias heroku for simpler multi-app projects | |
| heroku-app() { | |
| args=("$@") | |
| if [ "${args[1]}" = "staging" ]; then | |
| args+=("--app" "goodeggs-garbanzo-staging") | |
| index=1 | |
| elif [ "${args[1]}" = "production" ]; then | |
| args+=("--app" "goodeggs-garbanzo") | |
| index=1 | |
| else | |
| index=0 | |
| fi | |
| echo "Running heroku ${args[@]:$index}..." | |
| heroku ${args[@]:$index} | |
| } | |
| alias heroku=heroku-app |
Author
It appears on bash that I need to test args[0].
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Suggestions for improvement welcome! My shell scripting is primitive at best. I think this took as many google searches as there are characters in the function.
How about a per-project config file (.heroku_config?) that lists the app aliases for this function to use?