You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

imgur 566B

123456789101112131415161718192021
  1. #!/usr/bin/env elvish
  2. resp = [&]
  3. id = (from-json <~/sns/imgur.json)[SolitudeAnon][id]
  4. command = [-sLX POST 'https://api.imgur.com/3/image' --data-binary '@-' -H "Authorization: Client-ID "$id ]
  5. if (not-eq ?(tty -s) $ok) {
  6. resp = (all | base64 | curl $@command | from-json)
  7. } elif (> (count $args) 0) {
  8. resp = (base64 $args[0] | curl $@command | from-json)
  9. } else {
  10. exit 1
  11. }
  12. if (and (has-key $resp success) (eq $resp[success] $true)) {
  13. echo Uploaded to $resp[data][link]
  14. echo Delete hash: $resp[data][deletehash]
  15. } else {
  16. echo Upload failed
  17. exit 1
  18. }