From 09e22b67cd64b2a2f12a2943e34f326ed4a8db12 Mon Sep 17 00:00:00 2001 From: Michael Uleysky Date: Thu, 20 Jul 2023 16:17:04 +1000 Subject: [PATCH] Added keys _cmdline and _nargs into parsed arguments. --- src/ParseArgs.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ParseArgs.cpp b/src/ParseArgs.cpp index c858d0f..05dc4b1 100644 --- a/src/ParseArgs.cpp +++ b/src/ParseArgs.cpp @@ -5,12 +5,15 @@ CLArgs ParseArgs(int argc, char** argv) { CLArgs out; - out["_name"] = argv[0]; - for(int i = 0; i < argc; i++) + out["_nargs"] = MString(argc); + + out["_cmdline"] = out["_name"] = out["_arg0"] = argv[0]; + for(int i = 1; i < argc; i++) { MString carg = argv[i]; out["_arg" + MString(i)] = carg; bool namevalue = false; + out["_cmdline"] += " " + carg; for(size_t c = 0; c < carg.Len(); c++) if(carg[c] == '=')