summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Souter <p.souter@kainos.com>2014-12-19 11:52:11 +0000
committerPeter Souter <p.souter@kainos.com>2014-12-20 21:10:20 +0000
commitc125a0899435b26f7823bdf3793b4aeb27f4a707 (patch)
treef897be40ae6e2f94c7d5a8ceca539615271a4755
parent88e0e24d2b57b2b122d969f2c089f7b868d4f09a (diff)
README fixes for recent merges
* (MODULES-444) Update README for concat changes * (MODULES-1582) Update `validate_cmd` readme * Plus some Whitespace fixes
-rw-r--r--README.markdown13
1 files changed, 10 insertions, 3 deletions
diff --git a/README.markdown b/README.markdown
index 0c7b80a..689660e 100644
--- a/README.markdown
+++ b/README.markdown
@@ -129,7 +129,9 @@ strings; for example, 'hello\n' becomes 'hello'. Requires a single string or arr
* `chop`: Returns a new string with the last character removed. If the string ends with '\r\n', both characters are removed. Applying `chop` to an empty string returns an empty string. If you want to merely remove record separators, then you should use the `chomp` function. Requires a string or an array of strings as input. *Type*: rvalue
-* `concat`: Appends the contents of array 2 onto array 1. For example, `concat(['1','2','3'],'4')` results in: ['1','2','3','4']. *Type*: rvalue
+* `concat`: Appends the contents of multiple arrays onto array 1. For example:
+ * `concat(['1','2','3'],'4')` results in: ['1','2','3','4'].
+ * `concat(['1','2','3'],'4',['5','6','7'])` results in: ['1','2','3','4','5','6','7'].
* `count`: Takes an array as first argument and an optional second argument. Count the number of elements in array that matches second argument. If called with only an array, it counts the number of elements that are **not** nil/undef. *Type*: rvalue
@@ -569,13 +571,18 @@ The first argument of this function should be the string to test, and the second
*Type*: statement
-* `validate_cmd`: Performs validation of a string with an external command. The first argument of this function should be the string to test, and the second argument should be the path to a test command taking a file as last argument. If the command, launched against a tempfile containing the passed string, returns a non-null value, compilation aborts with a parse error.
+* `validate_cmd`: Performs validation of a string with an external command. The first argument of this function should be a string to test, and the second argument should be a path to a test command taking a % as a placeholder for the file path (will default to the end of the command if no % placeholder given). If the command, launched against a tempfile containing the passed string, returns a non-null value, compilation will abort with a parse error.
- You can pass a third argument as the error message raised and shown to the user:
+If a third argument is specified, this will be the error message raised and seen by the user.
```
+ # Defaults to end of path
validate_cmd($sudoerscontent, '/usr/sbin/visudo -c -f', 'Visudo failed to validate sudoers content')
```
+ ```
+ # % as file location
+ validate_cmd($haproxycontent, '/usr/sbin/haproxy -f % -c', 'Haproxy failed to validate config content')
+ ```
*Type*: statement