home/bin/up (view raw)
1#!/usr/bin/env bash
2
3LATEST_SCROT="$HOME/pics/scrots/latest.png"
4
5upload() {
6 out="$(curl -s -F "file=@$1" -F "key=$(pw -s fsrv)" https://x.icyphox.sh)"
7 case "$OSTYPE" in
8 darwin*)
9 printf "$out" | pbcopy
10 ;;
11 *)
12 printf "$out" | xclip -sel c
13 ;;
14 esac
15 printf "$out\n"
16}
17
18if [ "$1" == "l" ]; then
19 upload "$LATEST_SCROT"
20elif [ "$1" != "l" ]; then
21 upload "$1"
22fi