From f99e365be3aa3422a21939f3d6e12c241d304acb Mon Sep 17 00:00:00 2001 From: Bryan Roe Date: Thu, 20 Oct 2022 22:31:05 -0700 Subject: [PATCH] Added -export command line option to export modules --- meshservice/ServiceMain.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/meshservice/ServiceMain.c b/meshservice/ServiceMain.c index c8a6dc1..5d945e5 100644 --- a/meshservice/ServiceMain.c +++ b/meshservice/ServiceMain.c @@ -592,6 +592,12 @@ int wmain(int argc, char* wargv[]) ILibDuktape_ScriptContainer_CheckEmbedded(&integratedJavaScript, &integragedJavaScriptLen); } + if (argc > 1 && strcmp(argv[1], "-export") == 0 && integragedJavaScriptLen == 0) + { + integratedJavaScript = ILibString_Copy("require('code-utils').expand({embedded: true});process.exit();", 0); + integragedJavaScriptLen = (int)strnlen_s(integratedJavaScript, sizeof(ILibScratchPad)); + } + if (argc > 2 && strcmp(argv[1], "-exec") == 0 && integragedJavaScriptLen == 0) { integratedJavaScript = ILibString_Copy(argv[2], 0);