-
-
Save jackprophesy/195805 to your computer and use it in GitHub Desktop.
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 | |
## options to be accepted | |
optstr=m:dv ## colon follows options that require an argument | |
while getopts $optstr var | |
do | |
case $var in | |
v) verbose="-v" ;; | |
d) deploy=1;; | |
m) message=$OPTARG ;; | |
esac | |
done | |
shift $(( $OPTIND - 1 )) | |
verbose=${verbose:-"-q"} | |
deploy=${deploy:-0} | |
defaultmessage=${message:-"No commit message provided"} | |
if [ $verbose = "-v" ]; then | |
echo -e 'Adding updated files to commit...' | |
git add -Av | |
echo -e 'Committing...' | |
git commit -a -m "$defaultmessage" -v | |
echo -e 'Pushing to origin master...' | |
git push -v origin master | |
else | |
echo -e 'Adding updated files to commit...' | |
git add -A | |
echo -e 'Committing...' | |
git commit -a -q -m "$defaultmessage" | |
echo -e 'Pushing to origin master...' | |
git push origin master | |
fi | |
if [ $deploy = 1 ]; then | |
echo -e 'Deploying...' | |
if [ $verbose = "-v" ]; then | |
cap deploy -v | |
else | |
cap deploy -q | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment