diff options
author | Colin Okay <okay@toyful.space> | 2022-02-20 11:32:48 -0600 |
---|---|---|
committer | Colin Okay <okay@toyful.space> | 2022-02-20 11:32:48 -0600 |
commit | 775e61a9ec40c080d8b2e5b82475ff6b4e862870 (patch) | |
tree | e64bbee6879e261e8514a5d8aaa21f93374284c0 /src/lib.lisp | |
parent | 1d8827f9ca76da9d69d81415d7563408b026ef70 (diff) |
trying to use magic ed to edit explainations
Diffstat (limited to 'src/lib.lisp')
-rw-r--r-- | src/lib.lisp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/lib.lisp b/src/lib.lisp index b21272a..b8c7343 100644 --- a/src/lib.lisp +++ b/src/lib.lisp @@ -12,9 +12,10 @@ (defvar *config* nil "A configuration plist") -(defun make-config (&key host api-token) +(defun make-config (&key host api-token editor) (append (when host (list :host host)) - (when api-token (list :api-token api-token)))) + (when api-token (list :api-token api-token)) + (when editor (list :editor editor)))) (defun valid-config-p (config) (and (listp config) @@ -51,6 +52,11 @@ (defun (setf api-token) (newval) (setf (getf *config* :api-token) newval)) +(defun make-temp-file-name () + (merge-pathnames (format nil "~a" (gensym "oneliners")) (uiop:temporary-directory))) + +(defun string-from-editor () + (magic-ed:magic-ed make-temp-file-name :eval nil :output :string)) (defun config-file () (merge-pathnames ".config/oneliners.config" (user-homedir-pathname))) @@ -102,12 +108,17 @@ the directories that appear in the value of that variable." (brief (prompt "Brief Description: ")) (tags - (when (y-or-n-p "Add tags in addition to: ~{~a ~}?" init-tags) - (ppcre:split " +" (prompt "(e.g. foo bar goo): ")))) + (append init-tags + (when (y-or-n-p "Add tags in addition to: ~{~a ~}?" init-tags) + (ppcre:split " +" (prompt "(e.g. foo bar goo): "))))) (explaination (when (y-or-n-p "Provide an explaination?") - (prompt "Go head: ")))) - (format t "Adding a new oneliner.~%") + (string-from-editor)))) + (format t "Adding a new oneliner.~%~s~%" + (list :oneliners oneliner + :tags tags + :brief brief + :explanation explaination)) ;; (api:request-with ;; (:host (host) |