MCPcopy Create free account
hub / github.com/Aslemammad/venode / validateArgs

Function validateArgs

venode/src/args.ts:14–39  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12const args: Args = { script: "", isVendor: false, importMap: "" };
13
14export const validateArgs = () => {
15 const vendor = argv.findIndex((arg) => arg === "vendor");
16 // vendor
17 if (vendor > -1) {
18 args.isVendor = true;
19 args.script = process.argv[vendor + 1];
20 }
21 // run
22 if (!args.script) {
23 args.isVendor = false;
24 const importMap = argv.findIndex((arg) => arg.includes("--import-map="));
25 if (importMap > -1) {
26 args.script = argv[importMap - 1];
27 args.importMap = argv[importMap].split("=")[1];
28 }
29 args.script ||= argv[argv.length - 1];
30 }
31 if (args.importMap) {
32 !existsSync(args.importMap) && log.error("--import-map value not found ");
33 }
34 !existsSync(args.script) && log.error("script not found");
35
36 args.script = path.resolve(args.script);
37
38 return args;
39};

Callers 1

cli.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected