aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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