@networkbase/cli 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/nb.mjs +46 -6
- package/package.json +1 -1
package/bin/nb.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import { fileURLToPath } from "node:url";
|
|
|
11
11
|
|
|
12
12
|
const CLI_SCRIPT_PATH = fileURLToPath(import.meta.url);
|
|
13
13
|
|
|
14
|
-
const CLI_VERSION = "1.0.
|
|
14
|
+
const CLI_VERSION = "1.0.4";
|
|
15
15
|
const DEFAULT_API_URL = process.env.NETWORKBASE_API_URL || "https://networkbase.in";
|
|
16
16
|
const GLOBAL_CONFIG_DIR = path.join(os.homedir(), ".networkbase");
|
|
17
17
|
const GLOBAL_CREDENTIALS_PATH = path.join(GLOBAL_CONFIG_DIR, "credentials.json");
|
|
@@ -391,6 +391,33 @@ function saveCredentials(creds) {
|
|
|
391
391
|
});
|
|
392
392
|
}
|
|
393
393
|
|
|
394
|
+
const BOOLEAN_FLAGS = new Set([
|
|
395
|
+
"json",
|
|
396
|
+
"force",
|
|
397
|
+
"dry-run",
|
|
398
|
+
"deliverable",
|
|
399
|
+
"draft",
|
|
400
|
+
"reference",
|
|
401
|
+
"done",
|
|
402
|
+
"wip",
|
|
403
|
+
"all",
|
|
404
|
+
"mine",
|
|
405
|
+
"yes",
|
|
406
|
+
"y",
|
|
407
|
+
"auto",
|
|
408
|
+
"reauth",
|
|
409
|
+
"allow-secrets",
|
|
410
|
+
"help",
|
|
411
|
+
"h",
|
|
412
|
+
"version",
|
|
413
|
+
"v",
|
|
414
|
+
"no-task",
|
|
415
|
+
"all-workspaces",
|
|
416
|
+
"uncheck",
|
|
417
|
+
"pull-only",
|
|
418
|
+
"daemon-worker",
|
|
419
|
+
]);
|
|
420
|
+
|
|
394
421
|
function parseFlags(argv) {
|
|
395
422
|
const positional = [];
|
|
396
423
|
const flags = {};
|
|
@@ -402,18 +429,31 @@ function parseFlags(argv) {
|
|
|
402
429
|
flags[arg.slice(2, eqIdx)] = arg.slice(eqIdx + 1);
|
|
403
430
|
} else {
|
|
404
431
|
const key = arg.slice(2);
|
|
405
|
-
|
|
406
|
-
if (next && !next.startsWith("-")) {
|
|
407
|
-
flags[key] = next;
|
|
408
|
-
i++;
|
|
409
|
-
} else {
|
|
432
|
+
if (BOOLEAN_FLAGS.has(key)) {
|
|
410
433
|
flags[key] = true;
|
|
434
|
+
} else {
|
|
435
|
+
const next = argv[i + 1];
|
|
436
|
+
if (next && !next.startsWith("-")) {
|
|
437
|
+
flags[key] = next;
|
|
438
|
+
i++;
|
|
439
|
+
} else {
|
|
440
|
+
flags[key] = true;
|
|
441
|
+
}
|
|
411
442
|
}
|
|
412
443
|
}
|
|
413
444
|
} else if (arg === "-m" && argv[i + 1]) {
|
|
414
445
|
flags.message = argv[++i];
|
|
415
446
|
} else if (arg === "-j") {
|
|
416
447
|
flags.json = true;
|
|
448
|
+
} else if (arg === "-y" || arg === "-Y") {
|
|
449
|
+
flags.yes = true;
|
|
450
|
+
flags.y = true;
|
|
451
|
+
} else if (arg === "-h") {
|
|
452
|
+
flags.help = true;
|
|
453
|
+
flags.h = true;
|
|
454
|
+
} else if (arg === "-v") {
|
|
455
|
+
flags.version = true;
|
|
456
|
+
flags.v = true;
|
|
417
457
|
} else {
|
|
418
458
|
positional.push(arg);
|
|
419
459
|
}
|