Last active
October 22, 2015 09:00
-
-
Save peel/99c97bca23afcb841a1a to your computer and use it in GitHub Desktop.
Aliases for managing github issues from ZSH with ghi gem
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
# Aliases for managing github issues | |
# | |
# preconditions: | |
# gem install ghi | |
# marks task as in progress | |
# creates task if it does not exist | |
# | |
# usage: | |
# ghidoing 1234 # will mark task 1234 as "in progress" | |
# ghidoing "lorem ipsum" # will create task "lorem ipsum" and mark it as "in progress" | |
ghidoing() { | |
if [[ "$1" = <-> ]] | |
then | |
ghi label "$1" -a "in progress" | |
ghi assign $1 $(git config user.name) | |
git checkout -b "f-issue-$1" | |
else | |
id = ghi open -m "$1" -L "in progress" | |
git checkout -b "f-issue-$(eval $id)" | |
ghi assign $1 $(git config user.name) | |
fi | |
} | |
# marks task as done | |
# creates task if it does not exist | |
# | |
# usage: | |
# ghidone 1234 # will close task 1234 | |
# ghidone "lorem ipsum" # will create task "lorem ipsum" and close it | |
ghidone() { | |
if [[ "$1" = <-> ]] | |
then | |
ghi close "$1" | |
git merge "f-issue-$1" develop | |
else | |
ghi close $(ghi open -m "$1" -L "in progress" | head -n 1 | awk 'match($0, /[0-9]+/){print substr($0, RSTART, RLENGTH)}') | |
ghi assign $1 $(git config user.name) | |
git merge "f-issue-$1" develop | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment