Skip to content
This repository has been archived by the owner on Sep 18, 2019. It is now read-only.

Commit

Permalink
Finish up qs script in bash (oauth version looks too tricky).
Browse files Browse the repository at this point in the history
  • Loading branch information
cespare committed Feb 13, 2012
1 parent 0f69af6 commit 19cf12b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion qs
Expand Up @@ -16,6 +16,7 @@ hash scrot 2>&- || fail "requires scrot (sudo apt-get install scrot)"
hash xclip 2>&- || fail "requires xclip (sudo apt-get install xclip)" hash xclip 2>&- || fail "requires xclip (sudo apt-get install xclip)"
hash curl 2>&- || fail "requires curl (sudo apt-get install curl)" hash curl 2>&- || fail "requires curl (sudo apt-get install curl)"
hash xdg-open 2>&- || fail "requires xdg-open (sudo apt-get install xdg-utils)" hash xdg-open 2>&- || fail "requires xdg-open (sudo apt-get install xdg-utils)"
hash ruby 2>&- || fail "requires ruby (sudo apt-get install ruby)"
[[ -z $IMGUR_API_KEY ]] && fail '$IMGUR_API_KEY needs to be set (to your Imgur developer API key).' [[ -z $IMGUR_API_KEY ]] && fail '$IMGUR_API_KEY needs to be set (to your Imgur developer API key).'




Expand All @@ -25,4 +26,7 @@ xdg-open $TEMP
read -p "Upload this screenshot to imgur? [yN] " -n 1 read -p "Upload this screenshot to imgur? [yN] " -n 1
echo echo
[[ ! $REPLY =~ ^[Yy]$ ]] && exit 1 [[ ! $REPLY =~ ^[Yy]$ ]] && exit 1
curl -F "image=@$TEMP" -F "key=$IMGUR_API_KEY" http://api.imgur.com/2/upload.json url=$(curl -F "image=@$TEMP" -F "key=$IMGUR_API_KEY" http://api.imgur.com/2/upload.json | ruby -pe '$_.match /"original":"([^"]*)",/; $_ = $1.gsub("\\", "")')
echo -n $url | xclip
echo "Image uploaded to imgur (this url is in your clipboard as well):"
echo $url

0 comments on commit 19cf12b

Please sign in to comment.