Created
August 13, 2016 21:09
-
-
Save sam33rdhakal/a88ba7d5e9a74cccd19851e4499b1762 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 | |
# [Type - name] - Message - {tickets} | |
# e.g. "[Feature - Product Filter] - Implements product filtering. - {GMO-1920,GMO-2020}" | |
# -f for feature | |
# -i for issue | |
# -r for refactor | |
# -c for Crash Fix | |
# -n for type name | |
# -m for commit message | |
# -t ticket number | |
while getopts ":fircn:m:t:" opt; do | |
case $opt in | |
f) TYPE="Feature"; >&2;; | |
i) TYPE="Issue"; >&2;; | |
r) TYPE="Refactor"; >&2;; | |
c) TYPE="Crash Fix"; >&2;; | |
n) NAME=$OPTARG >&2;; | |
m) MESSAGE=$OPTARG >&2;; | |
t) TICKETS=$OPTARG >&2;; | |
\?) echo "Invalid option: -$OPTARG" >&2; exit 1 ;; | |
:) echo "Missing option argument for -$OPTARG" >&2; exit 1;; | |
*) echo "Unimplemented option: -$OPTARG" >&2; exit 1;; | |
esac | |
done | |
if [ -n "$NAME" ]; then | |
NAME=" - "$NAME | |
fi | |
if [ -n "$TICKETS" ]; then | |
TICKETS=" - "{$TICKETS} | |
fi | |
OUTPUT=[$TYPE$NAME]" - "$MESSAGE$TICKETS | |
echo \"$OUTPUT\" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment