From 65df371822e6741f839b45ed39b85c832d4fea4c Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Mon, 27 May 2019 11:21:57 +0200 Subject: [PATCH] remove broken mkgist command --- README.md | 5 ----- sh/mkgist | 60 ------------------------------------------------------- 2 files changed, 65 deletions(-) delete mode 100755 sh/mkgist diff --git a/README.md b/README.md index 26efdf6..d5740a7 100644 --- a/README.md +++ b/README.md @@ -328,11 +328,6 @@ not the minute of the hour. * * * * * minutemaid 9 cd repo && git pull # runs every nine minutes ``` -### [mkgist](/sh/mkgist) - -(bash) makes a (mostly) empty gist and pulls it so you never have to visit the site. -i think this is broken. - ### [monitor](/sh/monitor) (zsh) literally just `watch` reimplemented as a shell script. kinda nice though. diff --git a/sh/mkgist b/sh/mkgist deleted file mode 100755 index cc8fcfe..0000000 --- a/sh/mkgist +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env bash - -mkgist() { - local token="$(< ~/.gisttoken)" - if [ $? -ne 0 ]; then - echo failed to read ~/.gisttoken -- do you have one? >&2 - echo https://github.com/settings/applications >&2 - return 1 - fi - - local public=true anon=0 desc= - while [ $# -gt 0 ]; do - case "$1" in - -p) public=false;; - -a) anon=1;; - -d) [ $# -lt 2 ] && desc= || desc="$2" - shift;; - *) echo "usage: $0 [-p] [-a] [-d {description}]" >&2 - return 1 - esac - shift - done - - local head= - [ $anon -eq 0 ] && head="Authorization: token $token" - - local rf="$(mktemp)" - if [ ! -O "$rf" ]; then - echo failed to create temporary output file >&2 - return 1 - fi - - # TODO: sanitize $desc - curl 'https://api.github.com/gists' -sSid@- -H "$head" -o "$rf" << EOF -{ - "description": "$desc", - "public": $public, - "files": { ".dummy": { "content": "." } } -} -EOF - - if [ $? -ne 0 ]; then - rm "$rf" - echo failed to POST to github >&2 - return 1 - fi - - sed -n '/Location/{s@.*/@@;p;q}' "$rf" | tr -d '\r ' | while read; do - echo "https://gist.github.com/$REPLY" - git clone "https://gist.github.com/$REPLY.git" - [ $? -eq 0 ] && ( - cd "$REPLY" - git rm .dummy - git remote set-url origin "git@gist.github.com:$REPLY.git" - ) - done - - rm "$rf" -} -mkgist "$@"