mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-16 19:57:52 +01:00
setup(tx): add support for passing flags down to commands
This commit is contained in:
@@ -25,7 +25,7 @@ import { fileURLToPath } from "url";
|
|||||||
import { performance } from "perf_hooks";
|
import { performance } from "perf_hooks";
|
||||||
import { createHash } from "crypto";
|
import { createHash } from "crypto";
|
||||||
|
|
||||||
const args = { _: [], exclude: [] };
|
const args = { _: [], exclude: [], force: false, verbose: false, all: false };
|
||||||
const shortFlags = { f: "force", v: "verbose", a: "all", e: "exclude" };
|
const shortFlags = { f: "force", v: "verbose", a: "all", e: "exclude" };
|
||||||
const arrayFlags = { exclude: true };
|
const arrayFlags = { exclude: true };
|
||||||
for (let i = 2; i < process.argv.length; i++) {
|
for (let i = 2; i < process.argv.length; i++) {
|
||||||
@@ -39,7 +39,8 @@ for (let i = 2; i < process.argv.length; i++) {
|
|||||||
args[flag] = value
|
args[flag] = value
|
||||||
? value.split(",")
|
? value.split(",")
|
||||||
: process.argv[++i]?.split(",") || [];
|
: process.argv[++i]?.split(",") || [];
|
||||||
else if (flag) args[flag] = true;
|
else if (flag && !!args[flag]) args[flag] = true;
|
||||||
|
else args._.push(arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -362,5 +363,8 @@ if (args.all) {
|
|||||||
await writeFile(tmp, JSON.stringify(cache));
|
await writeFile(tmp, JSON.stringify(cache));
|
||||||
await rename(tmp, cachePath);
|
await rename(tmp, cachePath);
|
||||||
console.timeEnd("Ready in");
|
console.timeEnd("Ready in");
|
||||||
await runScript(cmd, pkg.path, { verbose: true, args: args._.slice(1) });
|
await runScript(cmd, pkg.path, {
|
||||||
|
verbose: true,
|
||||||
|
args: ["--", ...args._.slice(1)]
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user