aboutsummaryrefslogtreecommitdiff
path: root/lib/client.lisp
diff options
context:
space:
mode:
authorColin Okay <colin@cicadas.surf>2022-09-15 16:36:03 -0500
committerColin Okay <colin@cicadas.surf>2022-09-15 16:36:03 -0500
commit62c755bff215540956ebbbe2534b8f0d7ec66656 (patch)
tree9011471862a34502bc0a5bd5baf0df0a8b13c74d /lib/client.lisp
parenteceb405b6ad0e5d4e094345c873a7d69a6bb5c35 (diff)
Refactor: ol draft new and ol modify redraft infer runstyle
Diffstat (limited to 'lib/client.lisp')
-rw-r--r--lib/client.lisp21
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/client.lisp b/lib/client.lisp
index 8a8c4be..e6324aa 100644
--- a/lib/client.lisp
+++ b/lib/client.lisp
@@ -176,11 +176,7 @@ running the body. If such a oneliner can be found."
(ppcre:split " +"
(prompt "More tags here, or Enter to skip: ")))))
(runstyle
- (string-upcase
- (prompt "Runstyle (auto or manual): "
- :expect 'valid-runstyle-p
- :retry-text "Must be (auto or manual): "
- :prefill "auto")))
+ (infer-runstyle))
(explanation
(when (y-or-n-p "Provide an explanation?")
(string-from-editor
@@ -197,6 +193,15 @@ running the body. If such a oneliner can be found."
(put-draft draft-name local)
(format t "Saved draft ~a~%" draft-name)))))
+(defun infer-runstyle ()
+ (if (or
+ (y-or-n-p "Will this command require user input?")
+ (y-or-n-p "Or invoke a GUI or TUI?")
+ (y-or-n-p "Will it require access to the shell history?"))
+ "MANUAL"
+ "AUTO"))
+
+
;;; EDITING ONELINERS
(defun edit-item (ident &optional draftp)
@@ -242,11 +247,7 @@ running the body. If such a oneliner can be found."
init-tags
:test 'equal)))))))
(runstyle
- (string-upcase
- (prompt "Runstyle (auto or manual): "
- :expect 'valid-runstyle-p
- :retry-text "Must be (auto or manual): "
- :prefill (oneliner-runstyle ol))))
+ (infer-runstyle))
(explanation
(when (y-or-n-p "Alter the explanation?")