Created
August 2, 2016 15:56
-
-
Save joshmanders/1f6fae94b36d108b442c04155c016b94 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# Usage: git-io URL [CODE] | |
# | |
# Turns a github.com URL | |
# into a git.io URL | |
URL="$1" | |
CODE="$2" | |
SHORT_URL=$(curl -si https://git.io -F "url=${URL}" ${CODE:+-F "code=${CODE}"} | grep 'Location:' | sed 's/Location: //') | |
echo "Copied URL to clipboard." | |
echo "${SHORT_URL}" | pbcopy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment