add create trello card to gitcopy

This commit is contained in:
xg 2019-06-18 19:35:57 +08:00
parent 2c3254c0a3
commit 86ec34cfd5

View File

@ -132,7 +132,7 @@ function init_db() {
function gitcopy() { function gitcopy() {
n=1 n=1
while getopts "c:n:" o; do while getopts "c:n:t:" o; do
case "${o}" in case "${o}" in
c) c)
commit=${OPTARG} commit=${OPTARG}
@ -140,6 +140,9 @@ function gitcopy() {
n) n)
n=${OPTARG} n=${OPTARG}
;; ;;
t)
trelloCardName=${OPTARG}
;;
*) *)
usage usage
;; ;;
@ -148,6 +151,9 @@ function gitcopy() {
prefix=`git remote get-url origin | sed -E 's/git@github.com:/https:\/\/github.com\//g' | sed -E 's/(.*)\.git/\1/'` 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/'` project_name=`echo $prefix | sed -E 's/.*\/(.*)/\1/'`
git log $commit --pretty="* [$project_name]($prefix/commit/%H) %an: **%s**" | head -n $n | tee >(pbcopy) 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() { function h() {