Permalink
Browse files

push: smarter pbcopy command detection, cleaner output

  • Loading branch information...
1 parent e19e09a commit 579fdd8f53c7fa7136bf5a21e4bf4af99340ad58 @jamiew committed Feb 17, 2011
Showing with 8 additions and 7 deletions.
  1. +8 −7 push
View
15 push
@@ -24,18 +24,19 @@ if echo $push | grep "Everything up-to-date" >/dev/null; then
exit 0
fi
-# Parse output into sexy GitHub compare URL!
+# Show git's output
echo $push
+
+# Parse output into sexy GitHub compare URL!
+# TODO only do this if the remote is actually on GitHub :)
remote_url=$(git remote show $remote -n | grep Push | awk '{ print $3 }')
-echo $remote_url
repo_name=$(echo $remote_url | sed 's/.*\:\(.*\)\.git/\1/')
-echo $repo_name
refs=$(echo $push | awk '{ print $3}' | sed 's/\.\./\.\.\./')
-echo $refs
github_url="https://github.com/$repo_name/compare/$refs"
-echo $github_url
-[ -n $(which pbcopy) ] && echo $github_url | pbcopy || echo "no 'pbcopy' command, skipping clipboard copy"
-# [ -n $(which open) ] && open -g $github_url || echo "no 'open' command, skipping browser open"
+echo "=> $github_url"
+which -s pbcopy && echo $github_url | pbcopy && echo "Compare URL copied to clipboard!"
+# which -s open && open -g $github_url
+echo
exit 0

0 comments on commit 579fdd8

Please sign in to comment.