From 86ec34cfd5df449fd1268c4a91e0f45c0c25b70f Mon Sep 17 00:00:00 2001 From: xg Date: Tue, 18 Jun 2019 19:35:57 +0800 Subject: [PATCH] add create trello card to gitcopy --- zsh/functions.zsh | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 8c2796f..ac81583 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -132,22 +132,28 @@ function init_db() { function gitcopy() { n=1 - while getopts "c:n:" o; do - case "${o}" in - c) - commit=${OPTARG} - ;; - n) - n=${OPTARG} - ;; - *) - usage - ;; - esac + while getopts "c:n:t:" o; do + case "${o}" in + c) + commit=${OPTARG} + ;; + n) + n=${OPTARG} + ;; + t) + trelloCardName=${OPTARG} + ;; + *) + usage + ;; + esac done prefix=`git remote get-url origin | sed -E 's/git@github.com:/https:\/\/github.com\//g' | sed -E 's/(.*)\.git/\1/'` project_name=`echo $prefix | sed -E 's/.*\/(.*)/\1/'` git log $commit --pretty="* [$project_name]($prefix/commit/%H) %an: **%s**" | head -n $n | tee >(pbcopy) + if [[ "$trelloCardName" != '' ]]; then + ruby ~/Projects/rallets-hub/bin/create_trello_todo_card.rb -n $trelloCardName -d "$(pbpaste)" + fi } function h() {