Skip to content

Commit

Permalink
Improved sprunge debug commend
Browse files Browse the repository at this point in the history
  • Loading branch information
G10h4ck committed Jun 22, 2014
1 parent 8a65306 commit 9dc29b2
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion packages/lime-debug/src/sprunge.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,23 @@
#!/bin/sh
curl -F 'sprunge=<-' http://sprunge.us <&0

SPRUNGE_URL="http://sprunge.us"

TEMP_FILE="$(mktemp)"
COMMAND="$0 $@"

usage()
{
echo -e "Suggested ways of using $0 are mainly 3\nyourCommand | $0\n$0 [ -c command ]\n$0 [ -f file ]" 1>&2 ; exit 0
}

case "${1}" in
"-h") usage ;;
"--help") usage ;;
"-c") echo "${COMMAND}" > "${TEMP_FILE}" ; ${2} | tee -a "${TEMP_FILE}" ;;
"-f") echo "${COMMAND}" > "${TEMP_FILE}" ; cat "${2}" | tee -a "${TEMP_FILE}" ;;
*) tee <&0 "${TEMP_FILE}" ;;
esac

cat "${TEMP_FILE}" | curl -F 'sprunge=<-' "${SPRUNGE_URL}" 1>&2

rm -f "${TEMP_FILE}"

0 comments on commit 9dc29b2

Please sign in to comment.