@fluid-app/fluid-cli-droplets 0.1.345 → 0.1.346
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 +45 -41
- package/package.json +2 -2
- package/src/__tests__/manifest.test.ts +1 -0
- package/src/generated/categories.ts +3 -3
- package/src/generated/installations.ts +13 -15
- package/src/generated/primary.ts +15 -17
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createDomainCommand, getFluidApiBase } from "@fluid-app/fluid-cli";
|
|
1
|
+
import { createDomainCommand, declareInputs, getFluidApiBase } from "@fluid-app/fluid-cli";
|
|
2
2
|
import { open } from "node:fs/promises";
|
|
3
3
|
import Ajv2020 from "ajv/dist/2020.js";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
@@ -983,18 +983,18 @@ function registerPublishCommands(parent, ctx) {
|
|
|
983
983
|
//#endregion
|
|
984
984
|
//#region src/generated/categories.ts
|
|
985
985
|
function registerCategories(parent, ctx) {
|
|
986
|
-
parent.command("categories").description("categories").command("list").description("Returns a list of all droplet categories").action(async () => {
|
|
986
|
+
declareInputs(parent.command("categories").description("categories").command("list").description("Returns a list of all droplet categories").action(async () => {
|
|
987
987
|
const client = await ctx.getClient();
|
|
988
988
|
if (ctx.verbose) process.stderr.write("GET /api/droplet_categories\n");
|
|
989
989
|
const result = await client.get(`/api/droplet_categories`);
|
|
990
990
|
ctx.output(result);
|
|
991
|
-
});
|
|
991
|
+
}), () => []);
|
|
992
992
|
}
|
|
993
993
|
//#endregion
|
|
994
994
|
//#region src/generated/installations.ts
|
|
995
995
|
function registerInstallations(parent, ctx) {
|
|
996
996
|
const resource = parent.command("installations").description("installations");
|
|
997
|
-
resource.command("list").description("List droplet installations").option("--page <value>", "Page number for pagination").option("--per-page <value>", "Number of records per page (max: 100)").option("--category <value>", "Filter by droplet category").action(async (opts) => {
|
|
997
|
+
declareInputs(resource.command("list").description("List droplet installations").option("--page <value>", "Page number for pagination").option("--per-page <value>", "Number of records per page (max: 100)").option("--category <value>", "Filter by droplet category").action(async (opts) => {
|
|
998
998
|
const client = await ctx.getClient();
|
|
999
999
|
const params = {};
|
|
1000
1000
|
if (opts.page !== void 0) params["page"] = Number(opts.page);
|
|
@@ -1003,49 +1003,51 @@ function registerInstallations(parent, ctx) {
|
|
|
1003
1003
|
if (ctx.verbose) process.stderr.write("GET /api/droplet_installations\n");
|
|
1004
1004
|
const result = await client.get(`/api/droplet_installations`, params);
|
|
1005
1005
|
ctx.output(result);
|
|
1006
|
-
});
|
|
1007
|
-
resource.command("create").description("Create a droplet installation").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (opts) => {
|
|
1006
|
+
}), () => []);
|
|
1007
|
+
declareInputs(resource.command("create").description("Create a droplet installation").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (opts) => {
|
|
1008
1008
|
const client = await ctx.getClient();
|
|
1009
1009
|
let body;
|
|
1010
|
-
if (opts.bodyFile)
|
|
1011
|
-
|
|
1012
|
-
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
1013
|
-
} else if (opts.body) body = ctx.parseBody(opts.body);
|
|
1010
|
+
if (opts.bodyFile) body = ctx.parseBody(ctx.inputs.readFile(opts.bodyFile, "utf-8"));
|
|
1011
|
+
else if (opts.body) body = ctx.parseBody(opts.body);
|
|
1014
1012
|
if (ctx.verbose) process.stderr.write("POST /api/droplet_installations\n");
|
|
1015
1013
|
const result = await client.post(`/api/droplet_installations`, body);
|
|
1016
1014
|
ctx.output(result);
|
|
1017
|
-
})
|
|
1018
|
-
|
|
1015
|
+
}), (opts) => opts.bodyFile ? [{
|
|
1016
|
+
kind: "file",
|
|
1017
|
+
path: String(opts.bodyFile)
|
|
1018
|
+
}] : []);
|
|
1019
|
+
declareInputs(resource.command("get <uuid>").description("Show a droplet installation").action(async (uuid) => {
|
|
1019
1020
|
const client = await ctx.getClient();
|
|
1020
1021
|
if (ctx.verbose) process.stderr.write(`GET /api/droplet_installations/${uuid}
|
|
1021
1022
|
`);
|
|
1022
1023
|
const result = await client.get(`/api/droplet_installations/${uuid}`);
|
|
1023
1024
|
ctx.output(result);
|
|
1024
|
-
});
|
|
1025
|
-
resource.command("update <uuid>").description("Update a droplet installation").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (uuid, opts) => {
|
|
1025
|
+
}), () => []);
|
|
1026
|
+
declareInputs(resource.command("update <uuid>").description("Update a droplet installation").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (uuid, opts) => {
|
|
1026
1027
|
const client = await ctx.getClient();
|
|
1027
1028
|
let body;
|
|
1028
|
-
if (opts.bodyFile)
|
|
1029
|
-
|
|
1030
|
-
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
1031
|
-
} else if (opts.body) body = ctx.parseBody(opts.body);
|
|
1029
|
+
if (opts.bodyFile) body = ctx.parseBody(ctx.inputs.readFile(opts.bodyFile, "utf-8"));
|
|
1030
|
+
else if (opts.body) body = ctx.parseBody(opts.body);
|
|
1032
1031
|
if (ctx.verbose) process.stderr.write(`PUT /api/droplet_installations/${uuid}
|
|
1033
1032
|
`);
|
|
1034
1033
|
const result = await client.put(`/api/droplet_installations/${uuid}`, body);
|
|
1035
1034
|
ctx.output(result);
|
|
1036
|
-
})
|
|
1037
|
-
|
|
1035
|
+
}), (opts) => opts.bodyFile ? [{
|
|
1036
|
+
kind: "file",
|
|
1037
|
+
path: String(opts.bodyFile)
|
|
1038
|
+
}] : []);
|
|
1039
|
+
declareInputs(resource.command("delete <uuid>").description("Delete a droplet installation").action(async (uuid) => {
|
|
1038
1040
|
const client = await ctx.getClient();
|
|
1039
1041
|
if (ctx.verbose) process.stderr.write(`DELETE /api/droplet_installations/${uuid}
|
|
1040
1042
|
`);
|
|
1041
1043
|
const result = await client.delete(`/api/droplet_installations/${uuid}`);
|
|
1042
1044
|
ctx.output(result);
|
|
1043
|
-
});
|
|
1045
|
+
}), () => []);
|
|
1044
1046
|
}
|
|
1045
1047
|
//#endregion
|
|
1046
1048
|
//#region src/generated/primary.ts
|
|
1047
1049
|
function registerPrimary(parent, ctx) {
|
|
1048
|
-
parent.command("get-companies <uuid>").description("returns an array of companies using a droplet").option("--pagination <value>", "pagination").action(async (uuid, opts) => {
|
|
1050
|
+
declareInputs(parent.command("get-companies <uuid>").description("returns an array of companies using a droplet").option("--pagination <value>", "pagination").action(async (uuid, opts) => {
|
|
1049
1051
|
const client = await ctx.getClient();
|
|
1050
1052
|
const params = {};
|
|
1051
1053
|
if (opts.pagination !== void 0) params["pagination"] = opts.pagination;
|
|
@@ -1053,52 +1055,54 @@ function registerPrimary(parent, ctx) {
|
|
|
1053
1055
|
`);
|
|
1054
1056
|
const result = await client.get(`/api/droplets/${uuid}/companies`, params);
|
|
1055
1057
|
ctx.output(result);
|
|
1056
|
-
});
|
|
1057
|
-
parent.command("list").description("An array of available droplets").option("--pagination <value>", "pagination").action(async (opts) => {
|
|
1058
|
+
}), () => []);
|
|
1059
|
+
declareInputs(parent.command("list").description("An array of available droplets").option("--pagination <value>", "pagination").action(async (opts) => {
|
|
1058
1060
|
const client = await ctx.getClient();
|
|
1059
1061
|
const params = {};
|
|
1060
1062
|
if (opts.pagination !== void 0) params["pagination"] = opts.pagination;
|
|
1061
1063
|
if (ctx.verbose) process.stderr.write("GET /api/droplets\n");
|
|
1062
1064
|
const result = await client.get(`/api/droplets`, params);
|
|
1063
1065
|
ctx.output(result);
|
|
1064
|
-
});
|
|
1065
|
-
parent.command("create").description("creates a droplet").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (opts) => {
|
|
1066
|
+
}), () => []);
|
|
1067
|
+
declareInputs(parent.command("create").description("creates a droplet").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (opts) => {
|
|
1066
1068
|
const client = await ctx.getClient();
|
|
1067
1069
|
let body;
|
|
1068
|
-
if (opts.bodyFile)
|
|
1069
|
-
|
|
1070
|
-
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
1071
|
-
} else if (opts.body) body = ctx.parseBody(opts.body);
|
|
1070
|
+
if (opts.bodyFile) body = ctx.parseBody(ctx.inputs.readFile(opts.bodyFile, "utf-8"));
|
|
1071
|
+
else if (opts.body) body = ctx.parseBody(opts.body);
|
|
1072
1072
|
if (ctx.verbose) process.stderr.write("POST /api/droplets\n");
|
|
1073
1073
|
const result = await client.post(`/api/droplets`, body);
|
|
1074
1074
|
ctx.output(result);
|
|
1075
|
-
})
|
|
1076
|
-
|
|
1075
|
+
}), (opts) => opts.bodyFile ? [{
|
|
1076
|
+
kind: "file",
|
|
1077
|
+
path: String(opts.bodyFile)
|
|
1078
|
+
}] : []);
|
|
1079
|
+
declareInputs(parent.command("get <uuid>").description("shows a droplet").action(async (uuid) => {
|
|
1077
1080
|
const client = await ctx.getClient();
|
|
1078
1081
|
if (ctx.verbose) process.stderr.write(`GET /api/droplets/${uuid}
|
|
1079
1082
|
`);
|
|
1080
1083
|
const result = await client.get(`/api/droplets/${uuid}`);
|
|
1081
1084
|
ctx.output(result);
|
|
1082
|
-
});
|
|
1083
|
-
parent.command("update <uuid>").description("updates a droplet").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (uuid, opts) => {
|
|
1085
|
+
}), () => []);
|
|
1086
|
+
declareInputs(parent.command("update <uuid>").description("updates a droplet").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (uuid, opts) => {
|
|
1084
1087
|
const client = await ctx.getClient();
|
|
1085
1088
|
let body;
|
|
1086
|
-
if (opts.bodyFile)
|
|
1087
|
-
|
|
1088
|
-
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
1089
|
-
} else if (opts.body) body = ctx.parseBody(opts.body);
|
|
1089
|
+
if (opts.bodyFile) body = ctx.parseBody(ctx.inputs.readFile(opts.bodyFile, "utf-8"));
|
|
1090
|
+
else if (opts.body) body = ctx.parseBody(opts.body);
|
|
1090
1091
|
if (ctx.verbose) process.stderr.write(`PUT /api/droplets/${uuid}
|
|
1091
1092
|
`);
|
|
1092
1093
|
const result = await client.put(`/api/droplets/${uuid}`, body);
|
|
1093
1094
|
ctx.output(result);
|
|
1094
|
-
})
|
|
1095
|
-
|
|
1095
|
+
}), (opts) => opts.bodyFile ? [{
|
|
1096
|
+
kind: "file",
|
|
1097
|
+
path: String(opts.bodyFile)
|
|
1098
|
+
}] : []);
|
|
1099
|
+
declareInputs(parent.command("delete <uuid>").description("deletes a droplet").action(async (uuid) => {
|
|
1096
1100
|
const client = await ctx.getClient();
|
|
1097
1101
|
if (ctx.verbose) process.stderr.write(`DELETE /api/droplets/${uuid}
|
|
1098
1102
|
`);
|
|
1099
1103
|
const result = await client.delete(`/api/droplets/${uuid}`);
|
|
1100
1104
|
ctx.output(result);
|
|
1101
|
-
});
|
|
1105
|
+
}), () => []);
|
|
1102
1106
|
}
|
|
1103
1107
|
//#endregion
|
|
1104
1108
|
//#region src/generated/index.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-app/fluid-cli-droplets",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.346",
|
|
4
4
|
"description": "Fluid CLI commands for droplet management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.mjs",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@fluid-app/fluid-cli": "0.1.
|
|
20
|
+
"@fluid-app/fluid-cli": "0.1.350",
|
|
21
21
|
"ajv": "8.17.1",
|
|
22
22
|
"commander": "^12.0.0"
|
|
23
23
|
},
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// categories.ts — AUTO-GENERATED, DO NOT EDIT
|
|
2
2
|
import { Command } from "commander";
|
|
3
|
-
import type
|
|
3
|
+
import { declareInputs, type CommandContext } from "@fluid-app/fluid-cli";
|
|
4
4
|
|
|
5
5
|
export function registerCategories(parent: Command, ctx: CommandContext): void {
|
|
6
6
|
const resource = parent.command("categories").description("categories");
|
|
7
7
|
|
|
8
|
-
resource
|
|
8
|
+
declareInputs(resource
|
|
9
9
|
.command("list")
|
|
10
10
|
.description("Returns a list of all droplet categories")
|
|
11
11
|
.action(async () => {
|
|
@@ -13,6 +13,6 @@ export function registerCategories(parent: Command, ctx: CommandContext): void {
|
|
|
13
13
|
if (ctx.verbose) process.stderr.write("GET " + `/api/droplet_categories` + "\n");
|
|
14
14
|
const result = await client.get(`/api/droplet_categories`);
|
|
15
15
|
ctx.output(result);
|
|
16
|
-
});
|
|
16
|
+
}), () => []);
|
|
17
17
|
|
|
18
18
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// installations.ts — AUTO-GENERATED, DO NOT EDIT
|
|
2
2
|
import { Command } from "commander";
|
|
3
|
-
import type
|
|
3
|
+
import { declareInputs, type CommandContext } from "@fluid-app/fluid-cli";
|
|
4
4
|
|
|
5
5
|
export function registerInstallations(parent: Command, ctx: CommandContext): void {
|
|
6
6
|
const resource = parent.command("installations").description("installations");
|
|
7
7
|
|
|
8
|
-
resource
|
|
8
|
+
declareInputs(resource
|
|
9
9
|
.command("list")
|
|
10
10
|
.description("List droplet installations")
|
|
11
11
|
.option("--page <value>", "Page number for pagination")
|
|
@@ -20,9 +20,9 @@ export function registerInstallations(parent: Command, ctx: CommandContext): voi
|
|
|
20
20
|
if (ctx.verbose) process.stderr.write("GET " + `/api/droplet_installations` + "\n");
|
|
21
21
|
const result = await client.get(`/api/droplet_installations`, params);
|
|
22
22
|
ctx.output(result);
|
|
23
|
-
});
|
|
23
|
+
}), () => []);
|
|
24
24
|
|
|
25
|
-
resource
|
|
25
|
+
declareInputs(resource
|
|
26
26
|
.command("create")
|
|
27
27
|
.description("Create a droplet installation")
|
|
28
28
|
.option("--body <json>", "Request body as JSON string")
|
|
@@ -31,17 +31,16 @@ export function registerInstallations(parent: Command, ctx: CommandContext): voi
|
|
|
31
31
|
const client = await ctx.getClient();
|
|
32
32
|
let body: unknown;
|
|
33
33
|
if (opts.bodyFile) {
|
|
34
|
-
|
|
35
|
-
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
34
|
+
body = ctx.parseBody(ctx.inputs.readFile(opts.bodyFile, "utf-8"));
|
|
36
35
|
} else if (opts.body) {
|
|
37
36
|
body = ctx.parseBody(opts.body);
|
|
38
37
|
}
|
|
39
38
|
if (ctx.verbose) process.stderr.write("POST " + `/api/droplet_installations` + "\n");
|
|
40
39
|
const result = await client.post(`/api/droplet_installations`, body);
|
|
41
40
|
ctx.output(result);
|
|
42
|
-
});
|
|
41
|
+
}), (opts) => (opts.bodyFile ? [{ kind: "file", path: String(opts.bodyFile) }] : []));
|
|
43
42
|
|
|
44
|
-
resource
|
|
43
|
+
declareInputs(resource
|
|
45
44
|
.command("get <uuid>")
|
|
46
45
|
.description("Show a droplet installation")
|
|
47
46
|
.action(async (uuid) => {
|
|
@@ -49,9 +48,9 @@ export function registerInstallations(parent: Command, ctx: CommandContext): voi
|
|
|
49
48
|
if (ctx.verbose) process.stderr.write("GET " + `/api/droplet_installations/${uuid}` + "\n");
|
|
50
49
|
const result = await client.get(`/api/droplet_installations/${uuid}`);
|
|
51
50
|
ctx.output(result);
|
|
52
|
-
});
|
|
51
|
+
}), () => []);
|
|
53
52
|
|
|
54
|
-
resource
|
|
53
|
+
declareInputs(resource
|
|
55
54
|
.command("update <uuid>")
|
|
56
55
|
.description("Update a droplet installation")
|
|
57
56
|
.option("--body <json>", "Request body as JSON string")
|
|
@@ -60,17 +59,16 @@ export function registerInstallations(parent: Command, ctx: CommandContext): voi
|
|
|
60
59
|
const client = await ctx.getClient();
|
|
61
60
|
let body: unknown;
|
|
62
61
|
if (opts.bodyFile) {
|
|
63
|
-
|
|
64
|
-
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
62
|
+
body = ctx.parseBody(ctx.inputs.readFile(opts.bodyFile, "utf-8"));
|
|
65
63
|
} else if (opts.body) {
|
|
66
64
|
body = ctx.parseBody(opts.body);
|
|
67
65
|
}
|
|
68
66
|
if (ctx.verbose) process.stderr.write("PUT " + `/api/droplet_installations/${uuid}` + "\n");
|
|
69
67
|
const result = await client.put(`/api/droplet_installations/${uuid}`, body);
|
|
70
68
|
ctx.output(result);
|
|
71
|
-
});
|
|
69
|
+
}), (opts) => (opts.bodyFile ? [{ kind: "file", path: String(opts.bodyFile) }] : []));
|
|
72
70
|
|
|
73
|
-
resource
|
|
71
|
+
declareInputs(resource
|
|
74
72
|
.command("delete <uuid>")
|
|
75
73
|
.description("Delete a droplet installation")
|
|
76
74
|
.action(async (uuid) => {
|
|
@@ -78,6 +76,6 @@ export function registerInstallations(parent: Command, ctx: CommandContext): voi
|
|
|
78
76
|
if (ctx.verbose) process.stderr.write("DELETE " + `/api/droplet_installations/${uuid}` + "\n");
|
|
79
77
|
const result = await client.delete(`/api/droplet_installations/${uuid}`);
|
|
80
78
|
ctx.output(result);
|
|
81
|
-
});
|
|
79
|
+
}), () => []);
|
|
82
80
|
|
|
83
81
|
}
|
package/src/generated/primary.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// primary.ts — AUTO-GENERATED, DO NOT EDIT
|
|
2
2
|
import { Command } from "commander";
|
|
3
|
-
import type
|
|
3
|
+
import { declareInputs, type CommandContext } from "@fluid-app/fluid-cli";
|
|
4
4
|
|
|
5
5
|
export function registerPrimary(parent: Command, ctx: CommandContext): void {
|
|
6
6
|
|
|
7
|
-
parent
|
|
7
|
+
declareInputs(parent
|
|
8
8
|
.command("get-companies <uuid>")
|
|
9
9
|
.description("returns an array of companies using a droplet")
|
|
10
10
|
.option("--pagination <value>", "pagination")
|
|
@@ -15,9 +15,9 @@ export function registerPrimary(parent: Command, ctx: CommandContext): void {
|
|
|
15
15
|
if (ctx.verbose) process.stderr.write("GET " + `/api/droplets/${uuid}/companies` + "\n");
|
|
16
16
|
const result = await client.get(`/api/droplets/${uuid}/companies`, params);
|
|
17
17
|
ctx.output(result);
|
|
18
|
-
});
|
|
18
|
+
}), () => []);
|
|
19
19
|
|
|
20
|
-
parent
|
|
20
|
+
declareInputs(parent
|
|
21
21
|
.command("list")
|
|
22
22
|
.description("An array of available droplets")
|
|
23
23
|
.option("--pagination <value>", "pagination")
|
|
@@ -28,9 +28,9 @@ export function registerPrimary(parent: Command, ctx: CommandContext): void {
|
|
|
28
28
|
if (ctx.verbose) process.stderr.write("GET " + `/api/droplets` + "\n");
|
|
29
29
|
const result = await client.get(`/api/droplets`, params);
|
|
30
30
|
ctx.output(result);
|
|
31
|
-
});
|
|
31
|
+
}), () => []);
|
|
32
32
|
|
|
33
|
-
parent
|
|
33
|
+
declareInputs(parent
|
|
34
34
|
.command("create")
|
|
35
35
|
.description("creates a droplet")
|
|
36
36
|
.option("--body <json>", "Request body as JSON string")
|
|
@@ -39,17 +39,16 @@ export function registerPrimary(parent: Command, ctx: CommandContext): void {
|
|
|
39
39
|
const client = await ctx.getClient();
|
|
40
40
|
let body: unknown;
|
|
41
41
|
if (opts.bodyFile) {
|
|
42
|
-
|
|
43
|
-
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
42
|
+
body = ctx.parseBody(ctx.inputs.readFile(opts.bodyFile, "utf-8"));
|
|
44
43
|
} else if (opts.body) {
|
|
45
44
|
body = ctx.parseBody(opts.body);
|
|
46
45
|
}
|
|
47
46
|
if (ctx.verbose) process.stderr.write("POST " + `/api/droplets` + "\n");
|
|
48
47
|
const result = await client.post(`/api/droplets`, body);
|
|
49
48
|
ctx.output(result);
|
|
50
|
-
});
|
|
49
|
+
}), (opts) => (opts.bodyFile ? [{ kind: "file", path: String(opts.bodyFile) }] : []));
|
|
51
50
|
|
|
52
|
-
parent
|
|
51
|
+
declareInputs(parent
|
|
53
52
|
.command("get <uuid>")
|
|
54
53
|
.description("shows a droplet")
|
|
55
54
|
.action(async (uuid) => {
|
|
@@ -57,9 +56,9 @@ export function registerPrimary(parent: Command, ctx: CommandContext): void {
|
|
|
57
56
|
if (ctx.verbose) process.stderr.write("GET " + `/api/droplets/${uuid}` + "\n");
|
|
58
57
|
const result = await client.get(`/api/droplets/${uuid}`);
|
|
59
58
|
ctx.output(result);
|
|
60
|
-
});
|
|
59
|
+
}), () => []);
|
|
61
60
|
|
|
62
|
-
parent
|
|
61
|
+
declareInputs(parent
|
|
63
62
|
.command("update <uuid>")
|
|
64
63
|
.description("updates a droplet")
|
|
65
64
|
.option("--body <json>", "Request body as JSON string")
|
|
@@ -68,17 +67,16 @@ export function registerPrimary(parent: Command, ctx: CommandContext): void {
|
|
|
68
67
|
const client = await ctx.getClient();
|
|
69
68
|
let body: unknown;
|
|
70
69
|
if (opts.bodyFile) {
|
|
71
|
-
|
|
72
|
-
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
70
|
+
body = ctx.parseBody(ctx.inputs.readFile(opts.bodyFile, "utf-8"));
|
|
73
71
|
} else if (opts.body) {
|
|
74
72
|
body = ctx.parseBody(opts.body);
|
|
75
73
|
}
|
|
76
74
|
if (ctx.verbose) process.stderr.write("PUT " + `/api/droplets/${uuid}` + "\n");
|
|
77
75
|
const result = await client.put(`/api/droplets/${uuid}`, body);
|
|
78
76
|
ctx.output(result);
|
|
79
|
-
});
|
|
77
|
+
}), (opts) => (opts.bodyFile ? [{ kind: "file", path: String(opts.bodyFile) }] : []));
|
|
80
78
|
|
|
81
|
-
parent
|
|
79
|
+
declareInputs(parent
|
|
82
80
|
.command("delete <uuid>")
|
|
83
81
|
.description("deletes a droplet")
|
|
84
82
|
.action(async (uuid) => {
|
|
@@ -86,6 +84,6 @@ export function registerPrimary(parent: Command, ctx: CommandContext): void {
|
|
|
86
84
|
if (ctx.verbose) process.stderr.write("DELETE " + `/api/droplets/${uuid}` + "\n");
|
|
87
85
|
const result = await client.delete(`/api/droplets/${uuid}`);
|
|
88
86
|
ctx.output(result);
|
|
89
|
-
});
|
|
87
|
+
}), () => []);
|
|
90
88
|
|
|
91
89
|
}
|