Add command to upload current buffer to S3
This commit is contained in:
parent
bd170987eb
commit
374970a982
@ -2597,6 +2597,25 @@ Syntax highlighting for Dockerfiles:
|
|||||||
(general-def kubernetes-overview-mode-map "SPC" leader-map))
|
(general-def kubernetes-overview-mode-map "SPC" leader-map))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
* AWS
|
||||||
|
** S3
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defun save-to-s3-sentinel (proc event)
|
||||||
|
(cond ((string-match-p "finished" event)
|
||||||
|
(progn
|
||||||
|
(message (concat "Uploaded to " last-s3-url))
|
||||||
|
(kill-buffer "*aws-s3*")))
|
||||||
|
(t (message "Failed to upload to s3, check *aws-s3* buffer for details"))))
|
||||||
|
|
||||||
|
(defun save-to-s3 (bucket public)
|
||||||
|
(interactive "MS3 bucket URL (e.g. s3://bucket/filename): \nP")
|
||||||
|
(let* ((tmp-file (make-temp-file "s3-upload"))
|
||||||
|
(cmd `("aws" "s3" "cp" ,@(if public '("--acl" "public-read")) ,tmp-file ,bucket)))
|
||||||
|
(setq last-s3-url bucket)
|
||||||
|
(write-region (point-min) (point-max) tmp-file)
|
||||||
|
(let ((proc (apply #'start-process "aws-s3" "*aws-s3*" cmd)))
|
||||||
|
(set-process-sentinel proc #'save-to-s3-sentinel))))
|
||||||
|
#+END_SRC
|
||||||
* Lola
|
* Lola
|
||||||
Some functions to make my day job easier.
|
Some functions to make my day job easier.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user