Created
April 7, 2018 05:39
-
-
Save creikey/29ec5cb74ae343b17691ee78b2303ad1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# uses github.com/defunkt/gist | |
## run `gem install gist` | |
## make sure to run `gist --login` on install | |
# uses github.com/astrand/xclip | |
## run `sudo apt install xclip` | |
# this could be anything and it'll use zenity, nothing and it won't | |
use_zenity="" | |
if [ "$use_zenity" != "" ]; then | |
zenity --timeout 2 --question --text="Upload a gist?" | |
prompt_code="$?" | |
else | |
prompt_code="0" | |
fi | |
if [ "$prompt_code" == "0" ]; then | |
if [ "$(xclip -selection c -o)" != "" ]; then | |
url="$(xclip -selection c -o | gist)" | |
else | |
echo "Nothing in clipboard!" | |
exit | |
fi | |
echo "$url" | xclip -selection c | |
if [ "$use_zenity" != "" ]; then | |
zenity --timeout 1 --info --text="Gist uploaded to $url!" | |
fi | |
else | |
echo "Cancelling upload..." | |
fi |
Author
creikey
commented
Apr 7, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment