aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
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