From e59989078a22d8c2f0039039faa53e9207eb49f6 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Fri, 4 Mar 2022 16:26:00 -0600 Subject: add names in --edit --- src/lib.lisp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') 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 -- cgit v1.2.3