aboutsummaryrefslogtreecommitdiff
path: root/docs/markdown/snippets
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2018-12-02 22:40:43 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2018-12-04 23:44:17 +0200
commit58b838a80bfe1d3307e730c293ce91cb93b332c9 (patch)
treed4a385b084b63872a0768a0f439a4ab9bc794932 /docs/markdown/snippets
parentc17a80f47b772d759aeb0878aa767a768a6fdd0c (diff)
downloadmeson-58b838a80bfe1d3307e730c293ce91cb93b332c9.zip
meson-58b838a80bfe1d3307e730c293ce91cb93b332c9.tar.gz
meson-58b838a80bfe1d3307e730c293ce91cb93b332c9.tar.bz2
Can specify keyword arguments with a dict.
Diffstat (limited to 'docs/markdown/snippets')
-rw-r--r--docs/markdown/snippets/kwargdict.md28
1 files changed, 28 insertions, 0 deletions
diff --git a/docs/markdown/snippets/kwargdict.md b/docs/markdown/snippets/kwargdict.md
new file mode 100644
index 0000000..47c54d5
--- /dev/null
+++ b/docs/markdown/snippets/kwargdict.md
@@ -0,0 +1,28 @@
+## Can specify keyword arguments with a dictionary
+
+You can now specify keyword arguments for any function and method call
+with the `kwargs` keyword argument. This is perhaps best described
+with an example.
+
+```meson
+options = {'include_directories': include_directories('inc')}
+
+...
+
+executable(...
+ kwargs: options)
+```
+
+The above code is identical to this:
+
+```meson
+executable(...
+ include_directories: include_directories('inc'))
+```
+
+That is, Mesn will expand the dictionary given to `kwargs` as if the
+entries in it had been given as keyword arguments directly.
+
+Note that any individual argument can be specified either directly or
+with the `kwarg`` dict but not both. If a key is specified twice, it
+is a hard error.