aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build-app.lisp41
-rw-r--r--src/lib.lisp2
2 files changed, 40 insertions, 3 deletions
diff --git a/build-app.lisp b/build-app.lisp
index 0f62f62..21f896f 100644
--- a/build-app.lisp
+++ b/build-app.lisp
@@ -24,6 +24,41 @@ three items long, and is interpreted as TOKEN USERNAME PASSWORD. E.g.:
Would attempt to make a new user named c00lhacker with password
my1337pw.")
+(defparameter +oneliners-variables-help-text+
+"
+Oneliners may contain variables. There are positional variables and
+named variables.
+
+POSITIONAL VARIABLES appear in the oneliner as a # followed by a
+number, which must 1 or greater. For example:
+
+ echo Hello #1, Happy #2
+
+The #1 and #2 are a positional variables. You might call the above
+like
+
+ ol 8 Doofus Tuesday
+
+Assuming that the above is the 8th search result, then \"Hello Doofus,
+ Happy Tuesday\" would print to the console.
+
+NAMED VARIABLES are similar. They appear in the oneliner as # followed
+by an letter in the Roman alphabet, followed by any sequence of Roman
+letters, numbers, or the symbol _. For example:
+
+ echo Hello #name you get a #thing
+
+The #name and #thing are named variables. You might call the above like so:
+
+ ol 3 name=Goober thing='sock in the nose'
+
+Which should print \"Hello Goober you get a sock in the nose\".
+
+Finally, you can MIX POSITIONAL AND NAMED VARIABLES so long as, when
+you run the oneliner, all positional variables appear first.
+")
+
+
;;; CLON SYNOPSIS DEFINITION
(defsynopsis (:postfix "[TAGS ...] | N [ARGS ...]")
@@ -59,10 +94,12 @@ my1337pw.")
(flag :long-name "whois"
:description "View information about a contributor. ARGS is just a contributor handle.")
(enum :long-name "help"
- :enum '(:account :wiki :invites)
+ :enum '(:account :wiki :invites :variables)
:argument-name "TOPIC"
:description "Print help for a topic.
-Topics: wiki, account, invites"))
+Topics: wiki, account, invites, variables"))
+ (group (:header "Variables" :hidden t)
+ (text :contents +oneliners-variables-help-text+))
(group (:header "Wiki" :hidden t)
(text :contents "Options For Managing Oneliners")
(flag :long-name "add"
diff --git a/src/lib.lisp b/src/lib.lisp
index 249fb70..6f7f377 100644
--- a/src/lib.lisp
+++ b/src/lib.lisp
@@ -187,7 +187,7 @@ the directories that appear in the value of that variable."
(defun collect-named-arguments (oneliner)
(remove-duplicates
- (ppcre:all-matches-as-strings "#[A-Za-z_][A-Za-z0-9_]*" oneliner)
+ (ppcre:all-matches-as-strings "#[A-Za-z][A-Za-z0-9_]*" oneliner)
:test #'equal))
(defun handle-run-oneliner (ol &optional clip)