4개의 변경된 파일과 38개의 추가작업 그리고 2개의 파일을 삭제
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env elvish |
||||
|
||||
resp = [&] |
||||
id = (from-json <~/sns/imgur.json)[SolitudeAnon][id] |
||||
command = [-sLX POST 'https://api.imgur.com/3/image' --data-binary '@-' -H "Authorization: Client-ID "$id ] |
||||
|
||||
if (not-eq ?(tty -s) $ok) { |
||||
resp = (all | base64 | curl $@command | from-json) |
||||
} elif (> (count $args) 0) { |
||||
resp = (base64 $args[0] | curl $@command | from-json) |
||||
} else { |
||||
exit 1 |
||||
} |
||||
|
||||
if (and (has-key $resp success) (eq $resp[success] $true)) { |
||||
echo Uploaded to $resp[data][link] |
||||
echo Delete hash: $resp[data][deletehash] |
||||
} else { |
||||
echo Upload failed |
||||
exit 1 |
||||
} |
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env elvish |
||||
|
||||
if (== (count $args) 0) { |
||||
echo Provide deletion hash |
||||
exit 1 |
||||
} |
||||
|
||||
id = (from-json <~/sns/imgur.json)[SolitudeAnon][id] |
||||
resp = (curl -sLX DELETE 'https://api.imgur.com/3/image/'$args[0] -H 'Authorization: Client-ID '$id | from-json) |
||||
if (and (has-key $resp success) (eq $resp[success] $true)) { |
||||
echo Image deleted |
||||
} else { |
||||
echo Failed to delete image |
||||
exit 1 |
||||
} |
불러오는 중...
Reference in new issue