MCPcopy Create free account
hub / github.com/dethcrypto/dethcode / readArg

Function readArg

packages/vscode-host/scripts/argv.js:17–33  ·  view source on GitHub ↗

* @param {string} name

(name)

Source from the content-addressed store, hash-verified

15 * @param {string} name
16 */
17function readArg(name) {
18 if (process.argv.includes(`--${name}`)) return true;
19
20 const argWithValuePrefix = `--${name}=`;
21 const withValue = process.argv.find((arg) =>
22 arg.startsWith(argWithValuePrefix)
23 );
24
25 if (withValue) {
26 return withValue.replace(argWithValuePrefix, "");
27 }
28
29 const fromEnv = process.env[name.toUpperCase()];
30 if (fromEnv) return fromEnv;
31
32 return false;
33}

Callers 1

argv.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected