@wervt/cli 0.2.12 → 0.2.13
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/dist/index.mjs +43 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -543,6 +543,48 @@ const env = defineCommand({
|
|
|
543
543
|
if (Object.keys(set).length || unset.length) console.log("Applies from the next request.");
|
|
544
544
|
}
|
|
545
545
|
});
|
|
546
|
+
const accounts = defineCommand({
|
|
547
|
+
meta: {
|
|
548
|
+
name: "accounts",
|
|
549
|
+
description: "Admins: list accounts and their app limits, or set one"
|
|
550
|
+
},
|
|
551
|
+
args: {
|
|
552
|
+
email: {
|
|
553
|
+
type: "positional",
|
|
554
|
+
required: false,
|
|
555
|
+
description: "Account to change"
|
|
556
|
+
},
|
|
557
|
+
apps: {
|
|
558
|
+
type: "string",
|
|
559
|
+
description: "Apps the account may own: a number, \"none\" for no limit, \"default\""
|
|
560
|
+
},
|
|
561
|
+
...connection
|
|
562
|
+
},
|
|
563
|
+
async run({ args }) {
|
|
564
|
+
if (args.email) {
|
|
565
|
+
if (!args.apps) throw new Error("Pass --apps <n|none|default> to change the limit");
|
|
566
|
+
const apps = args.apps === "none" ? null : args.apps === "default" ? "default" : Number(args.apps);
|
|
567
|
+
const result = await (await api(`/v1/accounts/${encodeURIComponent(args.email)}`, args, {
|
|
568
|
+
method: "PATCH",
|
|
569
|
+
headers: { "content-type": "application/json" },
|
|
570
|
+
body: JSON.stringify({ apps })
|
|
571
|
+
})).json();
|
|
572
|
+
return console.log(`${result.email}: ${result.limits.apps ?? "no limit"} apps`);
|
|
573
|
+
}
|
|
574
|
+
const result = await (await api("/v1/accounts", args)).json();
|
|
575
|
+
console.log(`default: ${result.defaults.apps ?? "no limit"} apps per account`);
|
|
576
|
+
for (const account of result.accounts) {
|
|
577
|
+
const list = account.apps.length ? ` ${account.apps.join(", ")}` : "";
|
|
578
|
+
if (account.admin) {
|
|
579
|
+
console.log(`${account.email} ${account.apps.length} apps (admin)${list}`);
|
|
580
|
+
continue;
|
|
581
|
+
}
|
|
582
|
+
const limit = account.limits.apps ?? "no limit";
|
|
583
|
+
const own = "apps" in account.custom ? "" : " (default)";
|
|
584
|
+
console.log(`${account.email} ${account.apps.length}/${limit}${own}${list}`);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
});
|
|
546
588
|
const tokens = defineCommand({
|
|
547
589
|
meta: {
|
|
548
590
|
name: "tokens",
|
|
@@ -983,6 +1025,7 @@ runMain(defineCommand({
|
|
|
983
1025
|
reprovision,
|
|
984
1026
|
access,
|
|
985
1027
|
members,
|
|
1028
|
+
accounts,
|
|
986
1029
|
env,
|
|
987
1030
|
tokens,
|
|
988
1031
|
tasks,
|