diff options
Diffstat (limited to 'docs/markdown/snippets')
-rw-r--r-- | docs/markdown/snippets/kwargdict.md | 28 |
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. |