19 lines
801 B
EmacsLisp
19 lines
801 B
EmacsLisp
(defun my/dwim-shell-command/0x0-upload ()
|
|
"Upload the marked files to 0x0.st"
|
|
(interactive)
|
|
(let ((url "https://0x0.st"))
|
|
(dwim-shell-command-on-marked-files
|
|
"0x0 upload"
|
|
(format "curl -Ffile=@<<f>> -Fsecret= %s" url)
|
|
:utils "curl"
|
|
:post-process-template
|
|
;; Insert the single quotes at the appropriate place according to
|
|
;; 0x0.st example online:
|
|
;; curl -F'file=@yourfile.png' -Fsecret= https://0x0.st
|
|
;;
|
|
;; The placement of these single quotes confuse the escaping
|
|
;; mechanisms of dwim-shell-command, as it considers @ as the
|
|
;; opening 'quote' as it appears right in front of <<f>>.
|
|
(lambda (template path)
|
|
(string-replace "-Ffile" "-F'file"
|
|
(string-replace path (concat path "'") template))))))
|