aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorColin Okay <okay@toyful.space>2022-03-04 16:26:00 -0600
committerColin Okay <okay@toyful.space>2022-03-04 16:26:00 -0600
commite59989078a22d8c2f0039039faa53e9207eb49f6 (patch)
tree3fd16ad81f53cabdace90aabb9822f897224bbb6 /src
parenta9631a594c1c449b4125d591ae4538fdc4705159 (diff)
add names in --edit
Diffstat (limited to 'src')
-rw-r--r--src/lib.lisp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/lib.lisp b/src/lib.lisp
index ec44bca..4b821f1 100644
--- a/src/lib.lisp
+++ b/src/lib.lisp
@@ -275,6 +275,11 @@ and, failing that, try to fetch from configured server."
(defun valid-runstyle-p (string)
(member string '("auto" "manual") :test 'equalp))
+(defun valid-oneliner-name-p (string)
+ (or (equal string "")
+ (and (< 2 (length string))
+ (ppcre:scan "^[a-zA-Z][a-zA-Z0-9_\-]+$" string))))
+
(defun add-new-oneliner ()
(ensure-config)
(assert (api-token) () "Cannot add a oneliner without an api token.")
@@ -325,6 +330,13 @@ and, failing that, try to fetch from configured server."
:expect 'valid-oneliner-string-p
:retry-text "Oneliners must contain at least one command: "
:prefill (getf ol :oneliner)))
+ (name
+ (string-trim
+ '(#\space #\newline #\tab #\linefeed)
+ (prompt "Name (leave blank for none): "
+ :expect 'valid-oneliner-name-p
+ :retry-text "Must begin with a letter contain only letters, numbers, - and _."
+ :prefill (if (getf ol :name) (getf ol :name) ""))))
(brief
(prompt "Brief Description: "
:expect 'valid-brief-description-p
@@ -356,6 +368,7 @@ and, failing that, try to fetch from configured server."
(list :oneliner oneliner
:tags tags
:brief brief
+ :name name
:explanation explanation
:runstyle runstyle)))
(api:request-with