Created
July 13, 2023 16:01
-
-
Save chrisdone/3c2b315d792a914d0f9fb973946d559f to your computer and use it in GitHub Desktop.
shoe.el
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun shoe-write-script (script) | |
"Write SCRIPT to the proper place." | |
(let* ((script-dir (shoe-script-dir script)) | |
(script-path (shoe-script-file-path "/" script-dir))) | |
(with-temp-file script-path (insert script)))) | |
(defun shoe-script-file-path (script &optional dir) | |
"Produce the file path for SCRIPT." | |
(concat (or dir (shoe-script-dir script)) | |
"/" | |
"script.sh")) | |
(defun shoe-script-dir (script) | |
"Produce the data directory for SCRIPT and ensure it exists." | |
(let ((dir (concat (shoe-data-dir) "/" (shoe-script-name script)))) | |
(make-directory dir t) | |
dir)) | |
(defun shoe-data-dir () | |
"Produce the data directory and ensure it exists." | |
(let ((dir (expand-file-name "~/.shoe"))) | |
(make-directory dir t) | |
dir)) | |
(defun shoe-script-name (script) | |
"Produce a name from the given SCRIPT." | |
(secure-hash 'sha256 script)) | |
(defun shoe-gen-output-file-name (script) | |
"Use the current timestamp to produce a file-name for the given | |
SCRIPT. It's unique to the /nanosecond/." | |
(format-time-string "%Y%0m%0d-%0H%0M%0S-%0N")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment