From 5fe35b14052942884351b404296cc683b5982a91 Mon Sep 17 00:00:00 2001
From: xero <x@xero.nu>
Date: Sat, 7 Mar 2015 13:11:47 -0500
Subject: update gitio from http://git.io/gitio.sh

---
 sys/code/sys/gitio | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 79 insertions(+), 5 deletions(-)

(limited to 'sys/code')

diff --git a/sys/code/sys/gitio b/sys/code/sys/gitio
index 2c4ff61..47a1bfb 100755
--- a/sys/code/sys/gitio
+++ b/sys/code/sys/gitio
@@ -1,6 +1,80 @@
 #!/bin/sh
-echo -e "repo url:"
-read repo
-echo -e "short link:"
-read link
-curl -i http://git.io -F "url=$repo" -F "code=$link"
\ No newline at end of file
+#
+#          ██   ██      ██
+#   █████ ░░   ░██     ░░
+#  ██░░░██ ██ ██████    ██  ██████
+# ░██  ░██░██░░░██░    ░██ ██░░░░██
+# ░░██████░██  ░██     ░██░██   ░██
+#  ░░░░░██░██  ░██     ░██░██   ░██
+#   █████ ░██  ░░██  ██░██░░██████
+#  ░░░░░  ░░    ░░  ░░ ░░  ░░░░░░
+#
+# create short / vanity github urls
+#         ▟▙
+# ▟▒░░░░░░░▜▙▜████████████████████████████████▛
+# ▜▒░░░░░░░▟▛▟▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▛
+#         ▜▛
+# xero / syntax-samurai <http://git.io/gitio.sh>
+
+usage () {
+    cat <<EOF
+
+         ▟▙
+ ▟▒░░░░░░░▜▙▜████████████████████████████████▛
+ ▜▒░░░░░░░▟▛▟▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▛
+         ▜▛
+
+ create short / vanity github urls
+ usage: $(basename $0) http://github.com/something [-v mini]
+ 
+ options:
+  -v   shortlink
+  -h   display this screen
+EOF
+	exit 0
+}
+
+err() {
+	echo $1
+	usage	
+}
+
+optstest() {
+	found=0
+	for arg in "$@"
+	do
+		if echo $arg | cut -d/ -f3 | grep -Eq "github.com"
+		then
+			GHURL=$arg
+			found=1
+		elif [ $arg = "-h" ]
+		then
+			usage
+		elif [ $arg = "-v" ]
+		then
+			:
+		else
+			VANITY=$arg
+		fi
+	done
+	if [ $found = 0 ]
+	then
+		err " must be a valid github.com url!"
+	fi
+}
+
+case $# in
+	1)
+		optstest $1 ;;
+	3)
+		optstest $1 $2 $3 ;;
+	*)
+		err " invalid number of arguments!" ;;
+esac
+
+if [ -z "$VANITY" ]
+then
+	curl -i http://git.io -F "url=$GHURL"
+else
+	curl -i http://git.io -F "url=$GHURL" -F "code=$VANITY"
+fi
-- 
cgit v1.2.1