Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion imgur.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,22 @@ while [ $# -gt 0 ]; do
url="${url%%</link>*}"
delete_hash="${response##*<deletehash>}"
delete_hash="${delete_hash%%</deletehash>*}"
delete_page="https://imgur.com/delete/$delete_hash"
echo $url
echo "Delete page: https://imgur.com/delete/$delete_hash" >&2
[[ $url =~ "overload" ]] && exit 1
echo "Delete page: $delete_page" >&2

# Append the URL to a string so we can put them all on the clipboard later
clip+="$url"
if [ $# -gt 0 ]; then
clip+=$'\n'
fi

# Keep a log of the uploads
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nitpick, but please add a blank line before this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

IMGUR_LOG_FILE="$HOME/.imgur.sh.log"
if [ -n "${IMGUR_LOG_FILE-}" ]; then
echo "$(date +"%Y/%m/%d_%H:%M:%S") $url $delete_page $file" >>$HOME/.imgur.sh.log
fi
done

# Put the URLs on the clipboard if we can
Expand Down