Skip to content

Instantly share code, notes, and snippets.

@azu
Created June 1, 2012 13:58
Show Gist options
  • Save azu/2852351 to your computer and use it in GitHub Desktop.
Save azu/2852351 to your computer and use it in GitHub Desktop.
git-issue + percol + git-flow +readmine http://codestre.am/c500b5212252a09f4570c6d60
# LICENSE : MIT
function exists { which $1 &> /dev/null }
function is_issued() { # git-issueの設定があるか
ISSUE_TYPE=$(git config issue.type 2>/dev/null)
if [ "$ISSUE_TYPE" != "" ]; then
return 0
else
return 1
fi
}
if exists percol; then
# git-issue listからチケットを選んでgit flowのfeatureブランチを作る
function percol_select_from_git_issue_list_to_git_flow_feature_start() {
if $(is_issued) ; then
echo "Loading..."
TICKET=$(git-issue --no-color list | percol | sed -e 's/^#\([0-9]*\).*/\1/')
BUFFER="git flow feature start id/$TICKET"
CURSOR=$#BUFFER # カーソルを末尾に移動
# CURSOR=0 # カーソルを先頭に移動する
zle -R -c
else
echo "issue.typeが設定されてません"
echo # 上記のechoが出ない
zle reset-prompt
fi
}
# git-issue listからチケットを選んでチケットを終了&100%
function percol_select_from_git_issue_list_to_finish_ticket() {
if $(is_issued) ; then
echo "Loading..."
TICKET=$(git-issue --no-color list | percol | sed -e 's/^#\([0-9]*\).*/\1/')
BUFFER="git-issue update $TICKET --status=5 --ratio=100"
CURSOR=$#BUFFER # カーソルを末尾に移動
# CURSOR=0 # カーソルを先頭に移動する
zle -R -c
else
echo "issue.typeが設定されてません"
echo # 上記のechoが出ない
zle reset-prompt
fi
}
#git-issue listからチケットを選んで詳細情報の表示
function percol_select_from_git_issue() {
if $(is_issued) ; then
echo "Loading..."
TICKET=$(git-issue --no-color list | percol | sed -e 's/^#\([0-9]*\).*/\1/')
git-issue show $TICKET
else
echo "issue.typeが設定されてません"
echo # 上記のechoが出ない
zle reset-prompt
fi
}
zle -N percol_select_from_git_issue_list_to_git_flow_feature_start
bindkey '^B^F' percol_select_from_git_issue_list_to_git_flow_feature_start
zle -N percol_select_from_git_issue_list_to_finish_ticket
bindkey '^B^U' percol_select_from_git_issue_list_to_finish_ticket
zle -N percol_select_from_git_issue
bindkey '^B^I' percol_select_from_git_issue
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment