bdy 1.22.44-dev-distro → 1.22.45-beta
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/distTs/package.json +1 -1
- package/distTs/src/command/artifact/get.js +16 -9
- package/distTs/src/command/artifact/list.js +23 -8
- package/distTs/src/command/artifact/version/get.js +20 -13
- package/distTs/src/command/artifact/version/list.js +19 -12
- package/distTs/src/command/distro/list.js +18 -11
- package/distTs/src/command/distro/route/list.js +22 -13
- package/distTs/src/command/domain/get.js +17 -11
- package/distTs/src/command/domain/list.js +13 -6
- package/distTs/src/command/project/get.js +18 -0
- package/distTs/src/command/project/list.js +13 -6
- package/distTs/src/command/project/set.js +31 -0
- package/distTs/src/command/sandbox/app/list.js +13 -7
- package/distTs/src/command/sandbox/app/status.js +10 -4
- package/distTs/src/command/sandbox/cp.js +11 -3
- package/distTs/src/command/sandbox/endpoint/get.js +61 -52
- package/distTs/src/command/sandbox/endpoint/list.js +18 -12
- package/distTs/src/command/sandbox/exec/list.js +22 -16
- package/distTs/src/command/sandbox/exec/status.js +18 -9
- package/distTs/src/command/sandbox/get/yaml.js +30 -0
- package/distTs/src/command/sandbox/get.js +26 -18
- package/distTs/src/command/sandbox/list.js +21 -15
- package/distTs/src/command/sandbox/snapshot/get.js +19 -13
- package/distTs/src/command/sandbox/snapshot/list.js +17 -11
- package/distTs/src/command/sandbox/status.js +11 -5
- package/distTs/src/command/vt/scrape.js +193 -0
- package/distTs/src/command/whoami.js +17 -8
- package/distTs/src/command/workspace/list.js +14 -8
- package/distTs/src/output.js +8 -6
- package/distTs/src/texts.js +10 -7
- package/package.json +1 -1
- package/distTs/src/command/pipeline/run/apply.js +0 -62
package/distTs/package.json
CHANGED
|
@@ -10,6 +10,7 @@ const output_1 = __importDefault(require("../../output"));
|
|
|
10
10
|
const commandArtifactGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_ARTIFACT_GET);
|
|
11
11
|
commandArtifactGet.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
12
12
|
commandArtifactGet.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
13
|
+
commandArtifactGet.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
14
|
commandArtifactGet.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
14
15
|
commandArtifactGet.action(async (identifier, options) => {
|
|
15
16
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
@@ -23,14 +24,20 @@ commandArtifactGet.action(async (identifier, options) => {
|
|
|
23
24
|
output_1.default.exitError(texts_1.ERR_ARTIFACT_NOT_FOUND);
|
|
24
25
|
}
|
|
25
26
|
const art = await client.getArtifact(workspace, data.artifact_id);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
if (options.format === 'json') {
|
|
28
|
+
output_1.default.json(art);
|
|
29
|
+
output_1.default.exitNormal();
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
output_1.default.object({
|
|
33
|
+
Name: art.name,
|
|
34
|
+
Identifier: art.identifier,
|
|
35
|
+
Type: art.type,
|
|
36
|
+
Scope: art.scope,
|
|
37
|
+
Size: (0, utils_1.formatBytes)(art.size || 0),
|
|
38
|
+
Created: art.created_date,
|
|
39
|
+
});
|
|
40
|
+
output_1.default.exitNormal(`\n${(0, texts_1.TXT_ARTIFACT_PUBLISH)(client.baseUrl, workspace, art)}`);
|
|
41
|
+
}
|
|
35
42
|
});
|
|
36
43
|
exports.default = commandArtifactGet;
|
|
@@ -10,22 +10,37 @@ const input_1 = __importDefault(require("../../input"));
|
|
|
10
10
|
const commandArtifactList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_ARTIFACT_LIST);
|
|
11
11
|
commandArtifactList.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
12
12
|
commandArtifactList.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
13
|
+
commandArtifactList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
14
|
commandArtifactList.alias('ls');
|
|
14
15
|
commandArtifactList.action(async (options) => {
|
|
15
16
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
16
17
|
const project = input_1.default.restApiProject(options.project, true);
|
|
17
18
|
const client = input_1.default.restApiTokenClient();
|
|
18
19
|
const response = await client.getArtifacts(workspace, project);
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
const artifacts = response.artifacts || [];
|
|
21
|
+
if (options.format === 'json') {
|
|
22
|
+
const filtered = project
|
|
23
|
+
? artifacts.filter((a) => a.scope !== utils_1.ARTIFACT_SCOPE.WORKSPACE)
|
|
24
|
+
: artifacts;
|
|
25
|
+
output_1.default.json(filtered);
|
|
21
26
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
data
|
|
27
|
+
else {
|
|
28
|
+
if (artifacts.length === 0) {
|
|
29
|
+
output_1.default.exitError(texts_1.ERR_COMMAND_ARTIFACT_NO_PROJECTS);
|
|
30
|
+
}
|
|
31
|
+
const data = [['NAME', 'IDENTIFIER', 'TYPE', 'URL']];
|
|
32
|
+
for (const artifact of artifacts) {
|
|
33
|
+
if (project && artifact.scope === utils_1.ARTIFACT_SCOPE.WORKSPACE)
|
|
34
|
+
continue;
|
|
35
|
+
data.push([
|
|
36
|
+
artifact.name,
|
|
37
|
+
artifact.identifier,
|
|
38
|
+
artifact.type,
|
|
39
|
+
artifact.html_url,
|
|
40
|
+
]);
|
|
41
|
+
}
|
|
42
|
+
output_1.default.table(data);
|
|
27
43
|
}
|
|
28
|
-
output_1.default.table(data);
|
|
29
44
|
output_1.default.exitNormal();
|
|
30
45
|
});
|
|
31
46
|
exports.default = commandArtifactList;
|
|
@@ -10,6 +10,7 @@ const output_1 = __importDefault(require("../../../output"));
|
|
|
10
10
|
const commandArtifactVersionGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_ARTIFACT_VERSION_GET);
|
|
11
11
|
commandArtifactVersionGet.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
12
12
|
commandArtifactVersionGet.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
13
|
+
commandArtifactVersionGet.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
14
|
commandArtifactVersionGet.argument('<identifier>', texts_1.OPT_COMMAND_ARTIFACT_IDENTIFIER);
|
|
14
15
|
commandArtifactVersionGet.argument('<version>', texts_1.OPT_COMMAND_ARTIFACT_VERSION);
|
|
15
16
|
commandArtifactVersionGet.addHelpText('after', texts_1.EXAMPLE_ARTIFACT_VERSION_GET);
|
|
@@ -28,18 +29,24 @@ commandArtifactVersionGet.action(async (identifier, version, options) => {
|
|
|
28
29
|
output_1.default.exitError(texts_1.ERR_ARTIFACT_VERSION_NOT_FOUND);
|
|
29
30
|
}
|
|
30
31
|
const result = await client.getArtifactVersion(workspace, data.artifact_id, data.artifact_version_id);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
32
|
+
if (options.format === 'json') {
|
|
33
|
+
output_1.default.json(result);
|
|
34
|
+
output_1.default.exitNormal();
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
const obj = {
|
|
38
|
+
Version: result.version,
|
|
39
|
+
Size: (0, utils_1.formatBytes)(result.size),
|
|
40
|
+
Created: result.created_date,
|
|
41
|
+
'App url': result.html_url,
|
|
42
|
+
Url: result.version_url,
|
|
43
|
+
};
|
|
44
|
+
output_1.default.object(obj);
|
|
45
|
+
output_1.default.normal('');
|
|
46
|
+
const type = result.version_url.startsWith('https://')
|
|
47
|
+
? utils_1.ARTIFACT_TYPE.BUCKET
|
|
48
|
+
: utils_1.ARTIFACT_TYPE.CONTAINER;
|
|
49
|
+
output_1.default.exitNormal((0, texts_1.TXT_ARTIFACT_VERSION_DOWNLOAD)(type, identifier, version, result.version_url));
|
|
50
|
+
}
|
|
44
51
|
});
|
|
45
52
|
exports.default = commandArtifactVersionGet;
|
|
@@ -12,6 +12,7 @@ commandArtifactVersionList.option('-w, --workspace <domain>', texts_1.OPTION_RES
|
|
|
12
12
|
commandArtifactVersionList.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
13
13
|
commandArtifactVersionList.option('--page <number>', texts_1.OPTION_REST_API_PAGE, '1');
|
|
14
14
|
commandArtifactVersionList.option('--per-page <number>', texts_1.OPTION_REST_API_PER_PAGE, '10');
|
|
15
|
+
commandArtifactVersionList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
15
16
|
commandArtifactVersionList.alias('ls');
|
|
16
17
|
commandArtifactVersionList.argument('<identifier>', texts_1.OPT_COMMAND_ARTIFACT_IDENTIFIER);
|
|
17
18
|
commandArtifactVersionList.addHelpText('after', texts_1.EXAMPLE_ARTIFACT_VERSION_LIST);
|
|
@@ -29,19 +30,25 @@ commandArtifactVersionList.action(async (identifier, options) => {
|
|
|
29
30
|
output_1.default.exitError(texts_1.ERR_ARTIFACT_NOT_FOUND);
|
|
30
31
|
}
|
|
31
32
|
const result = await client.getArtifactVersions(workspace, data.artifact_id, page, perPage);
|
|
32
|
-
const
|
|
33
|
-
if (
|
|
34
|
-
output_1.default.
|
|
33
|
+
const versions = result.versions || [];
|
|
34
|
+
if (options.format === 'json') {
|
|
35
|
+
output_1.default.json(versions);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
if (versions.length === 0) {
|
|
39
|
+
output_1.default.exitError(texts_1.ERR_ARTIFACT_VERSIONS_NOT_FOUND);
|
|
40
|
+
}
|
|
41
|
+
const table = [['VERSION', 'SIZE', 'CREATED', 'URL']];
|
|
42
|
+
versions.forEach((ver) => {
|
|
43
|
+
table.push([
|
|
44
|
+
ver.version,
|
|
45
|
+
(0, utils_1.formatBytes)(ver.size),
|
|
46
|
+
ver.created_date,
|
|
47
|
+
ver.version_url,
|
|
48
|
+
]);
|
|
49
|
+
});
|
|
50
|
+
output_1.default.table(table);
|
|
35
51
|
}
|
|
36
|
-
result.versions.forEach((ver) => {
|
|
37
|
-
table.push([
|
|
38
|
-
ver.version,
|
|
39
|
-
(0, utils_1.formatBytes)(ver.size),
|
|
40
|
-
ver.created_date,
|
|
41
|
-
ver.version_url,
|
|
42
|
-
]);
|
|
43
|
-
});
|
|
44
|
-
output_1.default.table(table);
|
|
45
52
|
output_1.default.exitNormal();
|
|
46
53
|
});
|
|
47
54
|
exports.default = commandArtifactVersionList;
|
|
@@ -11,25 +11,32 @@ const commandDistroList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_D
|
|
|
11
11
|
commandDistroList.alias('ls');
|
|
12
12
|
commandDistroList.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
13
13
|
commandDistroList.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
14
|
+
commandDistroList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
14
15
|
commandDistroList.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_DISTRO_LIST}`);
|
|
15
16
|
commandDistroList.action(async (options) => {
|
|
16
17
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
17
18
|
const project = input_1.default.restApiProject(options.project, true);
|
|
18
19
|
const client = input_1.default.restApiTokenClient();
|
|
19
20
|
const r = await client.getDistributions(workspace, project);
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
const distributions = r.distributions || [];
|
|
22
|
+
if (options.format === 'json') {
|
|
23
|
+
output_1.default.json(distributions);
|
|
22
24
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
else {
|
|
26
|
+
if (distributions.length === 0) {
|
|
27
|
+
output_1.default.exitNormal(texts_1.TXT_COMMAND_DISTROS_NOT_FOUND);
|
|
28
|
+
}
|
|
29
|
+
const data = [['NAME', 'ID', 'IDENTIFIER', 'URL']];
|
|
30
|
+
for (const d of distributions) {
|
|
31
|
+
data.push([
|
|
32
|
+
d.name || '-',
|
|
33
|
+
String(d.id || '-'),
|
|
34
|
+
d.identifier || '-',
|
|
35
|
+
d.html_url || '-',
|
|
36
|
+
]);
|
|
37
|
+
}
|
|
38
|
+
output_1.default.table(data);
|
|
31
39
|
}
|
|
32
|
-
output_1.default.table(data);
|
|
33
40
|
output_1.default.exitNormal();
|
|
34
41
|
});
|
|
35
42
|
exports.default = commandDistroList;
|
|
@@ -11,6 +11,7 @@ const commandDistroRouteList = (0, utils_1.newCommand)('list', texts_1.DESC_COMM
|
|
|
11
11
|
commandDistroRouteList.alias('ls');
|
|
12
12
|
commandDistroRouteList.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
13
13
|
commandDistroRouteList.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
14
|
+
commandDistroRouteList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
14
15
|
commandDistroRouteList.argument('<identifier>', texts_1.OPT_COMMAND_DISTRO_IDENTIFIER);
|
|
15
16
|
commandDistroRouteList.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_ROUTE_LIST}`);
|
|
16
17
|
commandDistroRouteList.action(async (identifier, options) => {
|
|
@@ -25,21 +26,29 @@ commandDistroRouteList.action(async (identifier, options) => {
|
|
|
25
26
|
output_1.default.exitError(texts_1.ERR_COMMAND_DISTRO_NOT_FOUND);
|
|
26
27
|
}
|
|
27
28
|
const r = await client.listRoutes(workspace, project, data.distribution_id);
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
const routes = r.routes || [];
|
|
30
|
+
if (options.format === 'json') {
|
|
31
|
+
output_1.default.json(routes);
|
|
30
32
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
else {
|
|
34
|
+
if (routes.length === 0) {
|
|
35
|
+
output_1.default.exitNormal(texts_1.TXT_COMMAND_ROUTES_NOT_FOUND);
|
|
36
|
+
}
|
|
37
|
+
const table = [
|
|
38
|
+
['ID', 'TYPE', 'SUBDOMAIN', 'DOMAIN', 'PATH', 'URL'],
|
|
39
|
+
];
|
|
40
|
+
for (const route of routes) {
|
|
41
|
+
table.push([
|
|
42
|
+
route.id || '-',
|
|
43
|
+
route.type || '-',
|
|
44
|
+
route.subdomain || '-',
|
|
45
|
+
route.domain || '-',
|
|
46
|
+
route.path || '-',
|
|
47
|
+
route.html_url || '-',
|
|
48
|
+
]);
|
|
49
|
+
}
|
|
50
|
+
output_1.default.table(table);
|
|
41
51
|
}
|
|
42
|
-
output_1.default.table(table);
|
|
43
52
|
output_1.default.exitNormal();
|
|
44
53
|
});
|
|
45
54
|
exports.default = commandDistroRouteList;
|
|
@@ -9,6 +9,7 @@ const input_1 = __importDefault(require("../../input"));
|
|
|
9
9
|
const output_1 = __importDefault(require("../../output"));
|
|
10
10
|
const commandDomainGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_DOMAIN_GET);
|
|
11
11
|
commandDomainGet.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
12
|
+
commandDomainGet.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
12
13
|
commandDomainGet.argument('<id|name>', texts_1.OPTION_COMMAND_DOMAIN_IDENTIFIER);
|
|
13
14
|
commandDomainGet.action(async (name, options) => {
|
|
14
15
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
@@ -27,19 +28,24 @@ commandDomainGet.action(async (name, options) => {
|
|
|
27
28
|
if (!domain) {
|
|
28
29
|
output_1.default.exitError(texts_1.ERR_COMMAND_DOMAIN_NOT_FOUND);
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
if (options.format === 'json') {
|
|
32
|
+
output_1.default.json(domain);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
const props = {
|
|
36
|
+
Name: domain.name,
|
|
37
|
+
ID: domain.id,
|
|
38
|
+
Type: domain.type,
|
|
39
|
+
};
|
|
40
|
+
if (domain.type === 'REGISTERED') {
|
|
41
|
+
if (domain.expiry_date) {
|
|
42
|
+
props.Expires = domain.expiry_date;
|
|
43
|
+
}
|
|
44
|
+
props.Renew = domain.auto_renew ? 'Auto' : 'Manual';
|
|
38
45
|
}
|
|
39
|
-
props.
|
|
46
|
+
props.URL = domain.html_url;
|
|
47
|
+
output_1.default.object(props);
|
|
40
48
|
}
|
|
41
|
-
props.URL = domain.html_url;
|
|
42
|
-
output_1.default.object(props);
|
|
43
49
|
output_1.default.exitNormal();
|
|
44
50
|
});
|
|
45
51
|
exports.default = commandDomainGet;
|
|
@@ -10,18 +10,25 @@ const output_1 = __importDefault(require("../../output"));
|
|
|
10
10
|
const commandDomainList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_DOMAIN_LIST);
|
|
11
11
|
commandDomainList.alias('ls');
|
|
12
12
|
commandDomainList.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
13
|
+
commandDomainList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
14
|
commandDomainList.action(async (options) => {
|
|
14
15
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
15
16
|
const client = input_1.default.restApiTokenClient();
|
|
16
17
|
const response = await client.getDomains(workspace);
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
const domains = response.domains || [];
|
|
19
|
+
if (options.format === 'json') {
|
|
20
|
+
output_1.default.json(domains);
|
|
19
21
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
else {
|
|
23
|
+
if (domains.length === 0) {
|
|
24
|
+
output_1.default.exitError(texts_1.ERR_COMMAND_DOMAIN_NO_DOMAINS);
|
|
25
|
+
}
|
|
26
|
+
const data = [['NAME', 'ID', 'URL']];
|
|
27
|
+
for (const d of domains) {
|
|
28
|
+
data.push([d.name, d.id, d.html_url]);
|
|
29
|
+
}
|
|
30
|
+
output_1.default.table(data);
|
|
23
31
|
}
|
|
24
|
-
output_1.default.table(data);
|
|
25
32
|
output_1.default.exitNormal();
|
|
26
33
|
});
|
|
27
34
|
exports.default = commandDomainList;
|
|
@@ -0,0 +1,18 @@
|
|
|
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 cfg_1 = __importDefault(require("../../tunnel/cfg"));
|
|
7
|
+
const output_1 = __importDefault(require("../../output"));
|
|
8
|
+
const texts_1 = require("../../texts");
|
|
9
|
+
const utils_1 = require("../../utils");
|
|
10
|
+
const commandProjectGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_PROJECT_GET);
|
|
11
|
+
commandProjectGet.action(async () => {
|
|
12
|
+
const project = cfg_1.default.getProject();
|
|
13
|
+
if (!project) {
|
|
14
|
+
output_1.default.exitError(texts_1.TXT_PROJECT_NONE);
|
|
15
|
+
}
|
|
16
|
+
output_1.default.exitNormal(project);
|
|
17
|
+
});
|
|
18
|
+
exports.default = commandProjectGet;
|
|
@@ -10,18 +10,25 @@ const input_1 = __importDefault(require("../../input"));
|
|
|
10
10
|
const commandProjectList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_PROJECT_LIST);
|
|
11
11
|
commandProjectList.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
12
12
|
commandProjectList.alias('ls');
|
|
13
|
+
commandProjectList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
14
|
commandProjectList.action(async (options) => {
|
|
14
15
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
15
16
|
const client = input_1.default.restApiTokenClient();
|
|
16
17
|
const response = await client.getProjects(workspace);
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
const projects = response.projects || [];
|
|
19
|
+
if (options.format === 'json') {
|
|
20
|
+
output_1.default.json(projects);
|
|
19
21
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
else {
|
|
23
|
+
if (projects.length === 0) {
|
|
24
|
+
output_1.default.exitError(texts_1.ERR_PROJECT_NO_PROJECTS);
|
|
25
|
+
}
|
|
26
|
+
const data = [['NAME', 'DISPLAY NAME', 'STATUS', 'URL']];
|
|
27
|
+
for (const proj of projects) {
|
|
28
|
+
data.push([proj.name, proj.display_name, proj.status, proj.html_url]);
|
|
29
|
+
}
|
|
30
|
+
output_1.default.table(data);
|
|
23
31
|
}
|
|
24
|
-
output_1.default.table(data);
|
|
25
32
|
output_1.default.exitNormal();
|
|
26
33
|
});
|
|
27
34
|
exports.default = commandProjectList;
|
|
@@ -0,0 +1,31 @@
|
|
|
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 cfg_1 = __importDefault(require("../../tunnel/cfg"));
|
|
7
|
+
const output_1 = __importDefault(require("../../output"));
|
|
8
|
+
const texts_1 = require("../../texts");
|
|
9
|
+
const utils_1 = require("../../utils");
|
|
10
|
+
const input_1 = __importDefault(require("../../input"));
|
|
11
|
+
const commandProjectSet = (0, utils_1.newCommand)('set', texts_1.DESC_COMMAND_PROJECT_SET);
|
|
12
|
+
commandProjectSet.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
13
|
+
commandProjectSet.argument('[project]', texts_1.ARG_COMMAND_PROJECT_NAME);
|
|
14
|
+
commandProjectSet.action(async (project, options) => {
|
|
15
|
+
output_1.default.handleSignals();
|
|
16
|
+
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
17
|
+
const client = input_1.default.restApiTokenClient();
|
|
18
|
+
if (project) {
|
|
19
|
+
await client.getProject(workspace, project);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
const response = await client.getProjects(workspace);
|
|
23
|
+
project = await output_1.default.selectProject(response.projects);
|
|
24
|
+
}
|
|
25
|
+
cfg_1.default.setProject(project);
|
|
26
|
+
if (!project)
|
|
27
|
+
output_1.default.exitSuccess(texts_1.TXT_PROJECT_SET_CLEARED);
|
|
28
|
+
else
|
|
29
|
+
output_1.default.exitSuccess((0, texts_1.TXT_PROJECT_SET_SUCCESS)(project));
|
|
30
|
+
});
|
|
31
|
+
exports.default = commandProjectSet;
|
|
@@ -11,6 +11,7 @@ const commandSandboxAppList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMA
|
|
|
11
11
|
commandSandboxAppList.alias('ls');
|
|
12
12
|
commandSandboxAppList.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
13
13
|
commandSandboxAppList.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
14
|
+
commandSandboxAppList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
14
15
|
commandSandboxAppList.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
15
16
|
commandSandboxAppList.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_APP_LIST}`);
|
|
16
17
|
commandSandboxAppList.action(async (identifier, options) => {
|
|
@@ -22,14 +23,19 @@ commandSandboxAppList.action(async (identifier, options) => {
|
|
|
22
23
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
23
24
|
}
|
|
24
25
|
const { apps } = await client.getSandbox(workspace, sandbox_id);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
if (options.format === 'json') {
|
|
27
|
+
output_1.default.json(apps);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
const table = [['ID', 'COMMAND', 'STATUS']];
|
|
31
|
+
for (const app of apps) {
|
|
32
|
+
let command = app.command;
|
|
33
|
+
if (command.length > 20)
|
|
34
|
+
command = `${command.substring(0, 20)}...`;
|
|
35
|
+
table.push([app.id, command, app.app_status]);
|
|
36
|
+
}
|
|
37
|
+
output_1.default.table(table);
|
|
31
38
|
}
|
|
32
|
-
output_1.default.table(table);
|
|
33
39
|
output_1.default.exitNormal();
|
|
34
40
|
});
|
|
35
41
|
exports.default = commandSandboxAppList;
|
|
@@ -10,6 +10,7 @@ const output_1 = __importDefault(require("../../../output"));
|
|
|
10
10
|
const commandSandboxAppStatus = (0, utils_1.newCommand)('status', texts_1.DESC_COMMAND_SANDBOX_APP_STATUS);
|
|
11
11
|
commandSandboxAppStatus.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
12
12
|
commandSandboxAppStatus.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
13
|
+
commandSandboxAppStatus.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
14
|
commandSandboxAppStatus.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
14
15
|
commandSandboxAppStatus.argument('<app-id>', texts_1.OPTION_SANDBOX_APP_ID);
|
|
15
16
|
commandSandboxAppStatus.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_APP_STATUS}`);
|
|
@@ -26,10 +27,15 @@ commandSandboxAppStatus.action(async (identifier, appId, options) => {
|
|
|
26
27
|
if (!app) {
|
|
27
28
|
output_1.default.exitError(texts_1.ERR_SANDBOX_APP_NOT_FOUND);
|
|
28
29
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
if (options.format === 'json') {
|
|
31
|
+
output_1.default.json(app);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
output_1.default.object({
|
|
35
|
+
Command: app.command,
|
|
36
|
+
Status: app.app_status,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
33
39
|
output_1.default.exitNormal();
|
|
34
40
|
});
|
|
35
41
|
exports.default = commandSandboxAppStatus;
|
|
@@ -10,15 +10,17 @@ const input_1 = __importDefault(require("../../input"));
|
|
|
10
10
|
const path_1 = require("path");
|
|
11
11
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
12
12
|
const promises_1 = __importDefault(require("node:stream/promises"));
|
|
13
|
+
const picomatch_1 = __importDefault(require("picomatch"));
|
|
13
14
|
const commandSandboxCp = (0, utils_1.newCommand)('cp', texts_1.DESC_COMMAND_SANDBOX_CP);
|
|
14
15
|
commandSandboxCp.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
15
16
|
commandSandboxCp.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
16
17
|
commandSandboxCp.option('-m, --merge', texts_1.OPTION_SANDBOX_CP_DOWNLOAD_MERGE);
|
|
17
18
|
commandSandboxCp.option('-r, --replace', texts_1.OPTION_SANDBOX_CP_DOWNLOAD_REPLACE);
|
|
19
|
+
commandSandboxCp.option('--ignore <patterns...>', texts_1.OPTION_SANDBOX_CP_IGNORE);
|
|
18
20
|
commandSandboxCp.argument('<source>', texts_1.OPTION_SANDBOX_CP_SOURCE);
|
|
19
21
|
commandSandboxCp.argument('<destination>', texts_1.OPTION_SANDBOX_CP_DEST);
|
|
20
22
|
commandSandboxCp.addHelpText('after', texts_1.EXAMPLE_SANDBOX_CP);
|
|
21
|
-
const upload = async (client, workspace, project, source, destination) => {
|
|
23
|
+
const upload = async (client, workspace, project, source, destination, ignore) => {
|
|
22
24
|
const { fdir } = require('fdir');
|
|
23
25
|
const { sourcePath, sourceStats } = input_1.default.restApiSandboxUploadSourcePath(source);
|
|
24
26
|
const { identifier, remotePath, isRemoteDir } = input_1.default.restApiSandboxUploadDestinationPath(destination);
|
|
@@ -26,6 +28,9 @@ const upload = async (client, workspace, project, source, destination) => {
|
|
|
26
28
|
if (!sandbox_id) {
|
|
27
29
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
28
30
|
}
|
|
31
|
+
const isIgnored = ignore.length
|
|
32
|
+
? (0, picomatch_1.default)(ignore, { dot: true })
|
|
33
|
+
: null;
|
|
29
34
|
if (sourceStats.isFile()) {
|
|
30
35
|
// Single file copy
|
|
31
36
|
const name = (0, path_1.basename)(sourcePath);
|
|
@@ -36,10 +41,13 @@ const upload = async (client, workspace, project, source, destination) => {
|
|
|
36
41
|
}
|
|
37
42
|
else if (sourceStats.isDirectory()) {
|
|
38
43
|
// Directory copy - get all files recursively
|
|
39
|
-
const
|
|
44
|
+
const all = new fdir()
|
|
40
45
|
.withFullPaths()
|
|
41
46
|
.crawl(sourcePath)
|
|
42
47
|
.sync();
|
|
48
|
+
const files = isIgnored
|
|
49
|
+
? all.filter((p) => !isIgnored((0, path_1.relative)(sourcePath, p).replace(/\\/g, '/')))
|
|
50
|
+
: all;
|
|
43
51
|
if (files.length === 0) {
|
|
44
52
|
output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_CP_DONE)(0));
|
|
45
53
|
}
|
|
@@ -121,7 +129,7 @@ commandSandboxCp.action(async (source, destination, options) => {
|
|
|
121
129
|
const client = input_1.default.restApiTokenClient();
|
|
122
130
|
const isUpload = input_1.default.restApiSandboxIsUpload(destination);
|
|
123
131
|
if (isUpload) {
|
|
124
|
-
await upload(client, workspace, project, source, destination);
|
|
132
|
+
await upload(client, workspace, project, source, destination, options.ignore || []);
|
|
125
133
|
}
|
|
126
134
|
else {
|
|
127
135
|
await download(client, workspace, project, source, destination, !!options.merge, !!options.replace);
|