bdy 1.22.44-dev-distro → 1.22.45-dev

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.
Files changed (32) hide show
  1. package/distTs/package.json +1 -1
  2. package/distTs/src/command/artifact/get.js +16 -9
  3. package/distTs/src/command/artifact/list.js +23 -8
  4. package/distTs/src/command/artifact/version/get.js +20 -13
  5. package/distTs/src/command/artifact/version/list.js +19 -12
  6. package/distTs/src/command/distro/list.js +18 -11
  7. package/distTs/src/command/distro/route/list.js +22 -13
  8. package/distTs/src/command/domain/get.js +17 -11
  9. package/distTs/src/command/domain/list.js +13 -6
  10. package/distTs/src/command/project/get.js +18 -0
  11. package/distTs/src/command/project/list.js +13 -6
  12. package/distTs/src/command/project/set.js +31 -0
  13. package/distTs/src/command/sandbox/app/list.js +13 -7
  14. package/distTs/src/command/sandbox/app/status.js +10 -4
  15. package/distTs/src/command/sandbox/cp.js +11 -3
  16. package/distTs/src/command/sandbox/endpoint/get.js +61 -52
  17. package/distTs/src/command/sandbox/endpoint/list.js +18 -12
  18. package/distTs/src/command/sandbox/exec/list.js +22 -16
  19. package/distTs/src/command/sandbox/exec/status.js +18 -9
  20. package/distTs/src/command/sandbox/get/yaml.js +30 -0
  21. package/distTs/src/command/sandbox/get.js +26 -18
  22. package/distTs/src/command/sandbox/list.js +21 -15
  23. package/distTs/src/command/sandbox/snapshot/get.js +19 -13
  24. package/distTs/src/command/sandbox/snapshot/list.js +17 -11
  25. package/distTs/src/command/sandbox/status.js +11 -5
  26. package/distTs/src/command/vt/scrape.js +193 -0
  27. package/distTs/src/command/whoami.js +17 -8
  28. package/distTs/src/command/workspace/list.js +14 -8
  29. package/distTs/src/output.js +8 -6
  30. package/distTs/src/texts.js +10 -7
  31. package/package.json +1 -1
  32. package/distTs/src/command/pipeline/run/apply.js +0 -62
@@ -10,6 +10,7 @@ const input_1 = __importDefault(require("../../../input"));
10
10
  const commandSandboxEndpointGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_SANDBOX_ENDPOINT_GET);
11
11
  commandSandboxEndpointGet.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
12
12
  commandSandboxEndpointGet.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
13
+ commandSandboxEndpointGet.option('--format <text|json>', texts_1.OPTION_FORMAT);
13
14
  commandSandboxEndpointGet.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
14
15
  commandSandboxEndpointGet.argument('<endpoint-name>', texts_1.OPTION_SANDBOX_ENDPOINT_NAME_ARG);
15
16
  commandSandboxEndpointGet.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_ENDPOINT_GET}`);
@@ -27,68 +28,76 @@ commandSandboxEndpointGet.action(async (identifier, endpointName, options) => {
27
28
  if (!endpoint) {
28
29
  output_1.default.exitError(texts_1.ERR_SANDBOX_ENDPOINT_NOT_FOUND);
29
30
  }
30
- const data = [
31
- ['Field', 'Value'],
32
- ['Name', endpoint.name || '-'],
33
- ['Endpoint', endpoint.endpoint || '-'],
34
- ['Type', endpoint.type || '-'],
35
- ['Region', endpoint.region || '-'],
36
- ['URL', endpoint.endpoint_url || '-'],
37
- ['Timeout', endpoint.timeout?.toString() || '-'],
38
- ];
39
- if (endpoint.whitelist?.length) {
40
- data.push(['Whitelist', endpoint.whitelist?.join(', ')]);
31
+ if (options.format === 'json') {
32
+ output_1.default.json(endpoint);
41
33
  }
42
- if (endpoint.http) {
43
- data.push(['HTTP2', endpoint.http.http2 ? 'TRUE' : 'FALSE']);
44
- data.push([
45
- 'Verify certificate',
46
- endpoint.http.verify_certificate ? 'TRUE' : 'FALSE',
47
- ]);
48
- data.push(['Compression', endpoint.http.compression ? 'TRUE' : 'FALSE']);
49
- data.push([
50
- 'Log requests',
51
- endpoint.http.log_requests ? 'TRUE' : 'FALSE',
52
- ]);
53
- data.push(['Auth type', endpoint.http.auth_type]);
54
- if (endpoint.http.serve_path) {
55
- data.push(['Serve path', endpoint.http.serve_path]);
34
+ else {
35
+ const data = [
36
+ ['Field', 'Value'],
37
+ ['Name', endpoint.name || '-'],
38
+ ['Endpoint', endpoint.endpoint || '-'],
39
+ ['Type', endpoint.type || '-'],
40
+ ['Region', endpoint.region || '-'],
41
+ ['URL', endpoint.endpoint_url || '-'],
42
+ ['Timeout', endpoint.timeout?.toString() || '-'],
43
+ ];
44
+ if (endpoint.whitelist?.length) {
45
+ data.push(['Whitelist', endpoint.whitelist?.join(', ')]);
56
46
  }
57
- if (endpoint.http.circuit_breaker) {
58
- data.push(['Circuit breaker', String(endpoint.http.circuit_breaker)]);
59
- }
60
- if (endpoint.http.whitelist_user_agents?.length) {
47
+ if (endpoint.http) {
48
+ data.push(['HTTP2', endpoint.http.http2 ? 'TRUE' : 'FALSE']);
61
49
  data.push([
62
- 'Whitelist user agents',
63
- endpoint.http.whitelist_user_agents.join('\n'),
50
+ 'Verify certificate',
51
+ endpoint.http.verify_certificate ? 'TRUE' : 'FALSE',
64
52
  ]);
65
- }
66
- if (endpoint.http.rewrite_host_header) {
67
- data.push(['Rewrite host header', endpoint.http.rewrite_host_header]);
68
- }
69
- let headers = Object.keys(endpoint.http.request_headers || {});
70
- if (headers.length) {
71
53
  data.push([
72
- 'Request headers',
73
- headers
74
- .map((key) => `${key}: ${endpoint.http.request_headers[key]}`)
75
- .join('\n '),
54
+ 'Compression',
55
+ endpoint.http.compression ? 'TRUE' : 'FALSE',
76
56
  ]);
77
- }
78
- headers = Object.keys(endpoint.http.response_headers || {});
79
- if (headers.length) {
80
57
  data.push([
81
- 'Request headers',
82
- headers
83
- .map((key) => `${key}: ${endpoint.http.response_headers[key]}`)
84
- .join('\n '),
58
+ 'Log requests',
59
+ endpoint.http.log_requests ? 'TRUE' : 'FALSE',
85
60
  ]);
61
+ data.push(['Auth type', endpoint.http.auth_type]);
62
+ if (endpoint.http.serve_path) {
63
+ data.push(['Serve path', endpoint.http.serve_path]);
64
+ }
65
+ if (endpoint.http.circuit_breaker) {
66
+ data.push(['Circuit breaker', String(endpoint.http.circuit_breaker)]);
67
+ }
68
+ if (endpoint.http.whitelist_user_agents?.length) {
69
+ data.push([
70
+ 'Whitelist user agents',
71
+ endpoint.http.whitelist_user_agents.join('\n'),
72
+ ]);
73
+ }
74
+ if (endpoint.http.rewrite_host_header) {
75
+ data.push(['Rewrite host header', endpoint.http.rewrite_host_header]);
76
+ }
77
+ let headers = Object.keys(endpoint.http.request_headers || {});
78
+ if (headers.length) {
79
+ data.push([
80
+ 'Request headers',
81
+ headers
82
+ .map((key) => `${key}: ${endpoint.http.request_headers[key]}`)
83
+ .join('\n '),
84
+ ]);
85
+ }
86
+ headers = Object.keys(endpoint.http.response_headers || {});
87
+ if (headers.length) {
88
+ data.push([
89
+ 'Request headers',
90
+ headers
91
+ .map((key) => `${key}: ${endpoint.http.response_headers[key]}`)
92
+ .join('\n '),
93
+ ]);
94
+ }
86
95
  }
96
+ else if (endpoint.tls) {
97
+ data.push(['Terminate at', endpoint.tls.terminate_at]);
98
+ }
99
+ output_1.default.table(data);
87
100
  }
88
- else if (endpoint.tls) {
89
- data.push(['Terminate at', endpoint.tls.terminate_at]);
90
- }
91
- output_1.default.table(data);
92
101
  output_1.default.exitNormal();
93
102
  });
94
103
  exports.default = commandSandboxEndpointGet;
@@ -11,6 +11,7 @@ const commandSandboxEndpointList = (0, utils_1.newCommand)('list', texts_1.DESC_
11
11
  commandSandboxEndpointList.alias('ls');
12
12
  commandSandboxEndpointList.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
13
13
  commandSandboxEndpointList.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
14
+ commandSandboxEndpointList.option('--format <text|json>', texts_1.OPTION_FORMAT);
14
15
  commandSandboxEndpointList.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
15
16
  commandSandboxEndpointList.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_ENDPOINT_LIST}`);
16
17
  commandSandboxEndpointList.action(async (identifier, options) => {
@@ -23,20 +24,25 @@ commandSandboxEndpointList.action(async (identifier, options) => {
23
24
  }
24
25
  const sandbox = await client.getSandbox(workspace, sandbox_id);
25
26
  const endpoints = sandbox.endpoints || [];
26
- if (endpoints.length === 0) {
27
- output_1.default.exitError(texts_1.ERR_SANDBOX_ENDPOINTS_NOT_FOUND);
27
+ if (options.format === 'json') {
28
+ output_1.default.json(endpoints);
28
29
  }
29
- const data = [['Name', 'Endpoint', 'Type', 'Region', 'URL']];
30
- for (const ep of endpoints) {
31
- data.push([
32
- ep.name || '-',
33
- ep.endpoint || '-',
34
- ep.type || '-',
35
- ep.region || '-',
36
- ep.endpoint_url || '-',
37
- ]);
30
+ else {
31
+ if (endpoints.length === 0) {
32
+ output_1.default.exitError(texts_1.ERR_SANDBOX_ENDPOINTS_NOT_FOUND);
33
+ }
34
+ const data = [['Name', 'Endpoint', 'Type', 'Region', 'URL']];
35
+ for (const ep of endpoints) {
36
+ data.push([
37
+ ep.name || '-',
38
+ ep.endpoint || '-',
39
+ ep.type || '-',
40
+ ep.region || '-',
41
+ ep.endpoint_url || '-',
42
+ ]);
43
+ }
44
+ output_1.default.table(data);
38
45
  }
39
- output_1.default.table(data);
40
46
  output_1.default.exitNormal();
41
47
  });
42
48
  exports.default = commandSandboxEndpointList;
@@ -11,6 +11,7 @@ const commandSandboxExecList = (0, utils_1.newCommand)('list', texts_1.DESC_COMM
11
11
  commandSandboxExecList.alias('ls');
12
12
  commandSandboxExecList.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
13
13
  commandSandboxExecList.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
14
+ commandSandboxExecList.option('--format <text|json>', texts_1.OPTION_FORMAT);
14
15
  commandSandboxExecList.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
15
16
  commandSandboxExecList.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_EXEC_LIST}`);
16
17
  commandSandboxExecList.action(async (identifier, options) => {
@@ -23,24 +24,29 @@ commandSandboxExecList.action(async (identifier, options) => {
23
24
  }
24
25
  const commandsResult = await client.listSandboxCommands(workspace, sandbox_id);
25
26
  const commands = commandsResult.commands || [];
26
- if (commands.length === 0) {
27
- output_1.default.exitError(texts_1.ERR_SANDBOX_NO_COMMANDS);
28
- }
29
27
  commands.sort((a, b) => (b.id || '').localeCompare(a.id || ''));
30
- const data = [
31
- ['ID', 'COMMAND', 'STATUS', 'EXIT CODE', 'RUNTIME'],
32
- ];
33
- for (const cmd of commands) {
34
- data.push([
35
- cmd.id || '-',
36
- (cmd.command || '-').substring(0, 40) +
37
- (cmd.command?.length > 40 ? '...' : ''),
38
- cmd.status || '-',
39
- cmd.exit_code !== undefined ? String(cmd.exit_code) : '-',
40
- cmd.runtime || 'BASH',
41
- ]);
28
+ if (options.format === 'json') {
29
+ output_1.default.json(commands);
30
+ }
31
+ else {
32
+ if (commands.length === 0) {
33
+ output_1.default.exitError(texts_1.ERR_SANDBOX_NO_COMMANDS);
34
+ }
35
+ const data = [
36
+ ['ID', 'COMMAND', 'STATUS', 'EXIT CODE', 'RUNTIME'],
37
+ ];
38
+ for (const cmd of commands) {
39
+ data.push([
40
+ cmd.id || '-',
41
+ (cmd.command || '-').substring(0, 40) +
42
+ (cmd.command?.length > 40 ? '...' : ''),
43
+ cmd.status || '-',
44
+ cmd.exit_code !== undefined ? String(cmd.exit_code) : '-',
45
+ cmd.runtime || 'BASH',
46
+ ]);
47
+ }
48
+ output_1.default.table(data);
42
49
  }
43
- output_1.default.table(data);
44
50
  output_1.default.exitNormal();
45
51
  });
46
52
  exports.default = commandSandboxExecList;
@@ -10,6 +10,7 @@ const output_1 = __importDefault(require("../../../output"));
10
10
  const commandSandboxExecStatus = (0, utils_1.newCommand)('status', texts_1.DESC_COMMAND_SANDBOX_EXEC_STATUS);
11
11
  commandSandboxExecStatus.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
12
12
  commandSandboxExecStatus.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
13
+ commandSandboxExecStatus.option('--format <text|json>', texts_1.OPTION_FORMAT);
13
14
  commandSandboxExecStatus.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
14
15
  commandSandboxExecStatus.argument('<command-id>', texts_1.OPTION_SANDBOX_COMMAND_ID);
15
16
  commandSandboxExecStatus.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_EXEC_STATUS}`);
@@ -22,15 +23,23 @@ commandSandboxExecStatus.action(async (identifier, commandId, options) => {
22
23
  output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
23
24
  }
24
25
  const cmd = await client.getSandboxCommand(workspace, sandbox_id, commandId);
25
- const data = [
26
- ['Property', 'Value'],
27
- ['Command ID', cmd.id || '-'],
28
- ['Command', cmd.command || '-'],
29
- ['Runtime', cmd.runtime || 'BASH'],
30
- ['Status', cmd.status || '-'],
31
- ['Exit Code', cmd.exit_code !== undefined ? String(cmd.exit_code) : '-'],
32
- ];
33
- output_1.default.table(data);
26
+ if (options.format === 'json') {
27
+ output_1.default.json(cmd);
28
+ }
29
+ else {
30
+ const data = [
31
+ ['Property', 'Value'],
32
+ ['Command ID', cmd.id || '-'],
33
+ ['Command', cmd.command || '-'],
34
+ ['Runtime', cmd.runtime || 'BASH'],
35
+ ['Status', cmd.status || '-'],
36
+ [
37
+ 'Exit Code',
38
+ cmd.exit_code !== undefined ? String(cmd.exit_code) : '-',
39
+ ],
40
+ ];
41
+ output_1.default.table(data);
42
+ }
34
43
  output_1.default.exitNormal();
35
44
  });
36
45
  exports.default = commandSandboxExecStatus;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const utils_1 = require("../../../utils");
7
+ const texts_1 = require("../../../texts");
8
+ const input_1 = __importDefault(require("../../../input"));
9
+ const output_1 = __importDefault(require("../../../output"));
10
+ const commandSandboxGetYaml = (0, utils_1.newCommand)('yaml', texts_1.DESC_COMMAND_SANDBOX_GET_YAML);
11
+ commandSandboxGetYaml.hideVersionUpdate = true;
12
+ commandSandboxGetYaml.alias('yml');
13
+ commandSandboxGetYaml.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
14
+ commandSandboxGetYaml.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
15
+ commandSandboxGetYaml.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
16
+ commandSandboxGetYaml.action(async (identifier, options) => {
17
+ const workspace = input_1.default.restApiWorkspace(options.workspace);
18
+ const project = input_1.default.restApiProject(options.project);
19
+ const client = input_1.default.restApiTokenClient();
20
+ let result = await client.listSandboxes(workspace, project);
21
+ const sandboxes = result.sandboxes || [];
22
+ const found = sandboxes.find((s) => s.identifier === identifier);
23
+ if (!found) {
24
+ output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
25
+ }
26
+ const sandboxId = found.id;
27
+ result = await client.getSandboxYaml(workspace, sandboxId);
28
+ output_1.default.exitNormal(Buffer.from(result.yaml, 'base64').toString('utf8'));
29
+ });
30
+ exports.default = commandSandboxGetYaml;
@@ -10,6 +10,7 @@ const input_1 = __importDefault(require("../../input"));
10
10
  const commandSandboxGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_SANDBOX_GET);
11
11
  commandSandboxGet.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
12
12
  commandSandboxGet.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
13
+ commandSandboxGet.option('--format <text|json>', texts_1.OPTION_FORMAT);
13
14
  commandSandboxGet.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
14
15
  commandSandboxGet.action(async (identifier, options) => {
15
16
  const workspace = input_1.default.restApiWorkspace(options.workspace);
@@ -20,25 +21,32 @@ commandSandboxGet.action(async (identifier, options) => {
20
21
  output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
21
22
  }
22
23
  const sandbox = await client.getSandbox(workspace, sandbox_id);
23
- const data = [
24
- ['Field', 'Value'],
25
- ['ID', sandbox.id || '-'],
26
- ['Identifier', sandbox.identifier || '-'],
27
- ['Name', sandbox.name || '-'],
28
- ['Status', sandbox.status || '-'],
29
- ['Setup Status', sandbox.setup_status || '-'],
30
- ['OS', sandbox.os || '-'],
31
- ['Resources', sandbox.resources || '-'],
32
- ['Tags', (sandbox.tags || []).join(', ') || '-'],
33
- ['URL', sandbox.html_url || '-'],
34
- ];
35
- if (sandbox.endpoints && sandbox.endpoints.length > 0) {
36
- data.push([
37
- 'Endpoints',
38
- sandbox.endpoints.map((e) => `${e.name}: ${e.endpoint}`).join('\n'),
39
- ]);
24
+ if (options.format === 'json') {
25
+ output_1.default.json(sandbox);
26
+ }
27
+ else {
28
+ const data = [
29
+ ['Field', 'Value'],
30
+ ['ID', sandbox.id || '-'],
31
+ ['Identifier', sandbox.identifier || '-'],
32
+ ['Name', sandbox.name || '-'],
33
+ ['Status', sandbox.status || '-'],
34
+ ['Setup Status', sandbox.setup_status || '-'],
35
+ ['OS', sandbox.os || '-'],
36
+ ['Resources', sandbox.resources || '-'],
37
+ ['Tags', (sandbox.tags || []).join(', ') || '-'],
38
+ ['URL', sandbox.html_url || '-'],
39
+ ];
40
+ if (sandbox.endpoints && sandbox.endpoints.length > 0) {
41
+ data.push([
42
+ 'Endpoints',
43
+ sandbox.endpoints
44
+ .map((e) => `${e.name}: ${e.endpoint}`)
45
+ .join('\n'),
46
+ ]);
47
+ }
48
+ output_1.default.table(data);
40
49
  }
41
- output_1.default.table(data);
42
50
  output_1.default.exitNormal();
43
51
  });
44
52
  exports.default = commandSandboxGet;
@@ -11,29 +11,35 @@ const commandSandboxList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_
11
11
  commandSandboxList.alias('ls');
12
12
  commandSandboxList.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
13
13
  commandSandboxList.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
14
+ commandSandboxList.option('--format <text|json>', texts_1.OPTION_FORMAT);
14
15
  commandSandboxList.action(async (options) => {
15
16
  const workspace = input_1.default.restApiWorkspace(options.workspace);
16
17
  const project = input_1.default.restApiProject(options.project);
17
18
  const client = input_1.default.restApiTokenClient();
18
19
  const result = await client.listSandboxes(workspace, project);
19
20
  const sandboxes = result.sandboxes || [];
20
- if (sandboxes.length === 0) {
21
- output_1.default.exitNormal('No sandboxes found');
21
+ if (options.format === 'json') {
22
+ output_1.default.json(sandboxes);
22
23
  }
23
- const data = [
24
- ['NAME', 'STATUS', 'SETUP_STATUS', 'ID', 'IDENTIFIER', 'URL'],
25
- ];
26
- for (const sandbox of sandboxes) {
27
- data.push([
28
- sandbox.name || '-',
29
- sandbox.status || '-',
30
- sandbox.setup_status || '-',
31
- sandbox.id || '-',
32
- sandbox.identifier || '-',
33
- sandbox.html_url || '-',
34
- ]);
24
+ else {
25
+ if (sandboxes.length === 0) {
26
+ output_1.default.exitNormal('No sandboxes found');
27
+ }
28
+ const data = [
29
+ ['NAME', 'STATUS', 'SETUP_STATUS', 'ID', 'IDENTIFIER', 'URL'],
30
+ ];
31
+ for (const sandbox of sandboxes) {
32
+ data.push([
33
+ sandbox.name || '-',
34
+ sandbox.status || '-',
35
+ sandbox.setup_status || '-',
36
+ sandbox.id || '-',
37
+ sandbox.identifier || '-',
38
+ sandbox.html_url || '-',
39
+ ]);
40
+ }
41
+ output_1.default.table(data);
35
42
  }
36
- output_1.default.table(data);
37
43
  output_1.default.exitNormal();
38
44
  });
39
45
  exports.default = commandSandboxList;
@@ -10,6 +10,7 @@ const input_1 = __importDefault(require("../../../input"));
10
10
  const commandSandboxSnapshotGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_SANDBOX_SNAPSHOT_GET);
11
11
  commandSandboxSnapshotGet.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
12
12
  commandSandboxSnapshotGet.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
13
+ commandSandboxSnapshotGet.option('--format <text|json>', texts_1.OPTION_FORMAT);
13
14
  commandSandboxSnapshotGet.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
14
15
  commandSandboxSnapshotGet.argument('<snapshot-name>', texts_1.OPTION_SANDBOX_SNAPSHOT_NAME_ARG);
15
16
  commandSandboxSnapshotGet.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_SNAPSHOT_GET}`);
@@ -28,20 +29,25 @@ commandSandboxSnapshotGet.action(async (identifier, snapshotName, options) => {
28
29
  output_1.default.exitError(texts_1.ERR_SANDBOX_SNAPSHOT_NOT_FOUND);
29
30
  }
30
31
  const snapshot = await client.getSandboxSnapshot(workspace, sandbox_id, foundSnapshot.id);
31
- const data = [
32
- ['Field', 'Value'],
33
- ['Name', snapshot.name || '-'],
34
- ['Status', snapshot.status || '-'],
35
- ['Created', snapshot.create_date || '-'],
36
- ];
37
- if (snapshot.creator) {
38
- data.push([
39
- 'Creator',
40
- snapshot.creator.name || snapshot.creator.email || '-',
41
- ]);
32
+ if (options.format === 'json') {
33
+ output_1.default.json(snapshot);
34
+ }
35
+ else {
36
+ const data = [
37
+ ['Field', 'Value'],
38
+ ['Name', snapshot.name || '-'],
39
+ ['Status', snapshot.status || '-'],
40
+ ['Created', snapshot.create_date || '-'],
41
+ ];
42
+ if (snapshot.creator) {
43
+ data.push([
44
+ 'Creator',
45
+ snapshot.creator.name || snapshot.creator.email || '-',
46
+ ]);
47
+ }
48
+ data.push(['URL', snapshot.html_url]);
49
+ output_1.default.table(data);
42
50
  }
43
- data.push(['URL', snapshot.html_url]);
44
- output_1.default.table(data);
45
51
  output_1.default.exitNormal();
46
52
  });
47
53
  exports.default = commandSandboxSnapshotGet;
@@ -11,6 +11,7 @@ const commandSandboxSnapshotList = (0, utils_1.newCommand)('list', texts_1.DESC_
11
11
  commandSandboxSnapshotList.alias('ls');
12
12
  commandSandboxSnapshotList.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
13
13
  commandSandboxSnapshotList.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
14
+ commandSandboxSnapshotList.option('--format <text|json>', texts_1.OPTION_FORMAT);
14
15
  commandSandboxSnapshotList.argument('[identifier]', texts_1.OPTION_SANDBOX_IDENTIFIER);
15
16
  commandSandboxSnapshotList.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_SNAPSHOT_LIST}`);
16
17
  commandSandboxSnapshotList.action(async (identifier, options) => {
@@ -30,19 +31,24 @@ commandSandboxSnapshotList.action(async (identifier, options) => {
30
31
  const result = await client.listProjectSnapshots(workspace, project);
31
32
  snapshots = result.snapshots || [];
32
33
  }
33
- if (snapshots.length === 0) {
34
- output_1.default.exitError(texts_1.ERR_SANDBOX_SNAPSHOTS_NOT_FOUND);
34
+ if (options.format === 'json') {
35
+ output_1.default.json(snapshots);
35
36
  }
36
- const data = [['Name', 'Status', 'Created', 'URL']];
37
- for (const snapshot of snapshots) {
38
- data.push([
39
- snapshot.name || '-',
40
- snapshot.status || '-',
41
- snapshot.create_date || '-',
42
- snapshot.html_url || '-',
43
- ]);
37
+ else {
38
+ if (snapshots.length === 0) {
39
+ output_1.default.exitError(texts_1.ERR_SANDBOX_SNAPSHOTS_NOT_FOUND);
40
+ }
41
+ const data = [['Name', 'Status', 'Created', 'URL']];
42
+ for (const snapshot of snapshots) {
43
+ data.push([
44
+ snapshot.name || '-',
45
+ snapshot.status || '-',
46
+ snapshot.create_date || '-',
47
+ snapshot.html_url || '-',
48
+ ]);
49
+ }
50
+ output_1.default.table(data);
44
51
  }
45
- output_1.default.table(data);
46
52
  output_1.default.exitNormal();
47
53
  });
48
54
  exports.default = commandSandboxSnapshotList;
@@ -10,6 +10,7 @@ const input_1 = __importDefault(require("../../input"));
10
10
  const commandSandboxStatus = (0, utils_1.newCommand)('status', texts_1.DESC_COMMAND_SANDBOX_STATUS);
11
11
  commandSandboxStatus.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
12
12
  commandSandboxStatus.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
13
+ commandSandboxStatus.option('--format <text|json>', texts_1.OPTION_FORMAT);
13
14
  commandSandboxStatus.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
14
15
  commandSandboxStatus.action(async (identifier, options) => {
15
16
  const workspace = input_1.default.restApiWorkspace(options.workspace);
@@ -20,11 +21,16 @@ commandSandboxStatus.action(async (identifier, options) => {
20
21
  output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
21
22
  }
22
23
  const sandbox = await client.getSandbox(workspace, sandbox_id);
23
- output_1.default.table([
24
- ['Type', 'Status'],
25
- ['Status', sandbox.status || 'UNKNOWN'],
26
- ['Setup', sandbox.setup_status || 'UNKNOWN'],
27
- ]);
24
+ if (options.format === 'json') {
25
+ output_1.default.json(sandbox);
26
+ }
27
+ else {
28
+ output_1.default.table([
29
+ ['Type', 'Status'],
30
+ ['Status', sandbox.status || 'UNKNOWN'],
31
+ ['Setup', sandbox.setup_status || 'UNKNOWN'],
32
+ ]);
33
+ }
28
34
  output_1.default.exitNormal();
29
35
  });
30
36
  exports.default = commandSandboxStatus;