aboutsummaryrefslogtreecommitdiff
path: root/docs/markdown/snippets
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2017-09-29 10:07:29 -0700
committerDylan Baker <dylan@pnwbakers.com>2017-11-29 14:14:41 -0800
commitc9351ce30c03d107279090da7825096951a705d3 (patch)
treea9bf94236755986b2f69d2ef297e339c3c898561 /docs/markdown/snippets
parent7c779a76df9b8a4dd466b120f817b50f857081fa (diff)
downloadmeson-c9351ce30c03d107279090da7825096951a705d3.zip
meson-c9351ce30c03d107279090da7825096951a705d3.tar.gz
meson-c9351ce30c03d107279090da7825096951a705d3.tar.bz2
Add new array type option
This exposes the already existing UserStringArrayOption class through the meson_options.txt. The intention is to provide a way for projects to take list/array type arguments and validate that all of the elements in that array are valid without using complex looping constructrs.
Diffstat (limited to 'docs/markdown/snippets')
-rw-r--r--docs/markdown/snippets/option-array-type.md17
1 files changed, 17 insertions, 0 deletions
diff --git a/docs/markdown/snippets/option-array-type.md b/docs/markdown/snippets/option-array-type.md
new file mode 100644
index 0000000..f073dc1
--- /dev/null
+++ b/docs/markdown/snippets/option-array-type.md
@@ -0,0 +1,17 @@
+# An array type for user options
+
+Previously to have an option that took more than one value a string value would
+have to be created and split, but validating this was difficult. A new array type
+has been added to the meson_options.txt for this case. It works like a 'combo', but
+allows more than one option to be passed. When used on the command line (with -D),
+values are passed as a comma separated list.
+
+```meson
+option('array_opt', type : 'array', choices : ['one', 'two', 'three'], value : ['one'])
+```
+
+These can be overwritten on the command line,
+
+```meson
+meson _build -Darray_opt=two,three
+```