diff options
author | Jo-Philipp Wich <jo@mein.io> | 2020-09-17 13:57:22 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2020-09-20 20:45:26 +0200 |
commit | 9a74b811f007986a3e6015af0c06b33147d05951 (patch) | |
tree | 43e794cb1f35582c98eab8f8a1f4d54299cf2557 /eval.h | |
parent | 2601b1e17f5ba2e15fb16e126ec5d22a39246649 (diff) |
eval: implement -m option to preload modules
The -m option instructs the interpreter to automatically require the named
module and to register the module context as global variable.
The following two commands are equivalent, with the former one serving as
a shortcut for the latter:
utpl -m fs -s '{{ fs.open("test.txt").read("all") }}'
utpl -s '{% fs = require("fs"); print(fs.open("test.txt").read("all")) %}'
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'eval.h')
-rw-r--r-- | eval.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -43,6 +43,6 @@ struct json_object * ut_invoke(struct ut_state *, uint32_t, struct json_object *, struct json_object *, struct json_object *); enum ut_error_type -ut_run(struct ut_state *state, struct json_object *env); +ut_run(struct ut_state *state, struct json_object *env, struct json_object *modules); #endif |