From fe1a13a78389076130784d92183bfff50d67d86d Mon Sep 17 00:00:00 2001 From: hophacker Date: Wed, 19 Jun 2019 13:55:56 +0800 Subject: [PATCH] make gitcopy -t work in ubuntu by determining whether pbcopy exists --- zsh/functions.zsh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index ac81583..e44bb6b 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -150,9 +150,13 @@ function gitcopy() { 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) + commits=`git log $commit --pretty="* [$project_name]($prefix/commit/%H) %an: **%s**" | head -n $n` + which pbcopy + if [[ $? == '0' ]]; then + echo $commits | pbcopy + fi if [[ "$trelloCardName" != '' ]]; then - ruby ~/Projects/rallets-hub/bin/create_trello_todo_card.rb -n $trelloCardName -d "$(pbpaste)" + ruby ~/Projects/rallets-hub/bin/create_trello_todo_card.rb -n $trelloCardName -d "$commits" fi }