@@ -1,7 +1,7 @@ | |||
#!/bin/sh | |||
[ -z "$1" ] && return 1 || f=$(command -v "$1") | |||
if [ -z "$f" ]; then | |||
f="$HOME/bin/$1" | |||
f="$HOME/.local/bin/$1" | |||
$EDITOR "$f" | |||
[ -f "$f" ] && chmod +x "$f" | |||
else |
@@ -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 @@ | |||
#!/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 | |||
} |
@@ -228,7 +228,7 @@ edit:completion:arg-completer[brl] = [@cmd]{ | |||
} | |||
edit:completion:arg-completer[promotescript] = [@cmd]{ | |||
pwd=~/bin put * | |||
pwd=~/.local/bin fd -t f | |||
} | |||
edit:completion:arg-completer[edit-script] = $edit:complete-sudo~ |