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 | |
parent | 1d8827f9ca76da9d69d81415d7563408b026ef70 (diff) |
trying to use magic ed to edit explainations
-rw-r--r-- | clpmfile.lock | 3 | ||||
-rw-r--r-- | oneliners.cli.asd | 1 | ||||
-rw-r--r-- | src/lib.lisp | 23 |
3 files changed, 21 insertions, 6 deletions
diff --git a/clpmfile.lock b/clpmfile.lock index 15bb931..fcada2c 100644 --- a/clpmfile.lock +++ b/clpmfile.lock @@ -67,6 +67,7 @@ ("flexi-streams")) ("jonathan" :version "2020-09-25" :source "quicklisp" :systems ("jonathan")) ("local-time" :version "2021-01-24" :source "quicklisp" :systems ("local-time")) +("magic-ed" :version "2020-03-25" :source "quicklisp" :systems ("magic-ed")) ("named-readtables" :version "2021-12-09" :source "quicklisp" :systems ("named-readtables")) ("oneliners.api-client.asd" :version :newest :source :implicit-file :systems @@ -211,6 +212,8 @@ ("local-time" ((:system :name "cl-cookie") (:system :name "local-time"))) +("magic-ed" ((:system :name "oneliners.cli") (:system :name "magic-ed"))) + ("named-readtables" ((:system :name "net.didierverna.clon.setup") (:system :name "named-readtables")) diff --git a/oneliners.cli.asd b/oneliners.cli.asd index 9b390fd..4ac375f 100644 --- a/oneliners.cli.asd +++ b/oneliners.cli.asd @@ -8,6 +8,7 @@ "dexador" "osicat" "net.didierverna.clon" + "magic-ed" "oneliners.api-client") :components ((:module "src" :components 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) |