aboutsummaryrefslogtreecommitdiff
path: root/sys/code
diff options
context:
space:
mode:
authorxero <x@xero.nu>2015-03-07 13:11:47 -0500
committerxero <x@xero.nu>2015-03-07 13:11:47 -0500
commit5fe35b14052942884351b404296cc683b5982a91 (patch)
tree996eacf5573c2b8aa9276b8d4e91a16c487a7c05 /sys/code
parent337824fd1a9c1e2fc831df15102c5063fa2a22bf (diff)
downloaddotfiles_ascii-5fe35b14052942884351b404296cc683b5982a91.tar.xz
dotfiles_ascii-5fe35b14052942884351b404296cc683b5982a91.zip
update gitio from http://git.io/gitio.sh
Diffstat (limited to '')
-rwxr-xr-xsys/code/sys/gitio84
1 files changed, 79 insertions, 5 deletions
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