bdy 1.18.20-stage → 1.18.22-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.
- package/distTs/package.json +1 -3
- package/distTs/src/index.js +0 -6
- package/distTs/src/main.js +32 -12
- package/package.json +1 -3
package/distTs/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bdy",
|
|
3
3
|
"preferGlobal": false,
|
|
4
|
-
"version": "1.18.
|
|
4
|
+
"version": "1.18.22-dev",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {
|
|
@@ -66,7 +66,6 @@
|
|
|
66
66
|
"range-parser": "1.2.1",
|
|
67
67
|
"socket.io-client": "4.7.5",
|
|
68
68
|
"ssh2": "1.15.0",
|
|
69
|
-
"tabtab": "3.0.2",
|
|
70
69
|
"tar-stream": "3.1.7",
|
|
71
70
|
"terminal-kit": "3.1.1",
|
|
72
71
|
"undici": "6.23.0",
|
|
@@ -96,7 +95,6 @@
|
|
|
96
95
|
"@types/punycode": "2.1.4",
|
|
97
96
|
"@types/range-parser": "1.2.1",
|
|
98
97
|
"@types/ssh2": "1.15.5",
|
|
99
|
-
"@types/tabtab": "3.0.2",
|
|
100
98
|
"@types/tar-stream": "3.1.4",
|
|
101
99
|
"@types/terminal-kit": "2.5.6",
|
|
102
100
|
"@types/unzipper": "0.10.11",
|
package/distTs/src/index.js
CHANGED
|
@@ -24,8 +24,6 @@ const project_1 = __importDefault(require("./command/project"));
|
|
|
24
24
|
const whoami_1 = __importDefault(require("./command/whoami"));
|
|
25
25
|
const package_1 = __importDefault(require("./command/package"));
|
|
26
26
|
const api_1 = __importDefault(require("./command/api"));
|
|
27
|
-
const autocomplete_1 = __importDefault(require("./autocomplete"));
|
|
28
|
-
const autocomplete_2 = __importDefault(require("./command/autocomplete"));
|
|
29
27
|
const domain_1 = __importDefault(require("./command/domain"));
|
|
30
28
|
const main_1 = __importDefault(require("./main"));
|
|
31
29
|
stream_1.default.setDefaultHighWaterMark(false, 67108864);
|
|
@@ -56,11 +54,7 @@ program.addCommand(logout_1.default);
|
|
|
56
54
|
program.addCommand(workspace_1.default);
|
|
57
55
|
program.addCommand(project_1.default);
|
|
58
56
|
program.addCommand(api_1.default);
|
|
59
|
-
program.addCommand(autocomplete_2.default);
|
|
60
57
|
program.action(async () => {
|
|
61
58
|
await (0, main_1.default)(program);
|
|
62
59
|
});
|
|
63
|
-
if (autocomplete_1.default.init(program)) {
|
|
64
|
-
process.exit(0);
|
|
65
|
-
}
|
|
66
60
|
program.parse();
|
package/distTs/src/main.js
CHANGED
|
@@ -7,7 +7,7 @@ const output_1 = __importDefault(require("./output"));
|
|
|
7
7
|
const selectCommand = async (parentCommand) => {
|
|
8
8
|
let items = [];
|
|
9
9
|
const map = {};
|
|
10
|
-
parentCommand.commands.forEach((c) => {
|
|
10
|
+
parentCommand.commands.filter((c) => !c._hidden).forEach((c) => {
|
|
11
11
|
const name = c.name();
|
|
12
12
|
map[name] = c;
|
|
13
13
|
items.push({
|
|
@@ -16,17 +16,29 @@ const selectCommand = async (parentCommand) => {
|
|
|
16
16
|
value: name,
|
|
17
17
|
});
|
|
18
18
|
});
|
|
19
|
+
items = items.sort((a, b) => a.name.localeCompare(b.name));
|
|
20
|
+
const goBack = 'go back';
|
|
19
21
|
items.push({
|
|
20
22
|
name: 'help',
|
|
21
23
|
description: 'Display help for current command',
|
|
22
24
|
value: 'help',
|
|
23
25
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
if (parentCommand.parent) {
|
|
27
|
+
items.unshift({
|
|
28
|
+
name: goBack,
|
|
29
|
+
description: 'Go back to parent command',
|
|
30
|
+
value: goBack
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
output_1.default.clearPreviousLine();
|
|
34
|
+
const name = await output_1.default.inputMenuAdv(getFinalCommand(parentCommand, {}, []), items);
|
|
26
35
|
if (name === 'help') {
|
|
27
36
|
parentCommand.help();
|
|
28
37
|
output_1.default.exitNormal();
|
|
29
38
|
}
|
|
39
|
+
else if (name === goBack && parentCommand.parent) {
|
|
40
|
+
return await selectCommand(parentCommand.parent);
|
|
41
|
+
}
|
|
30
42
|
const cmd = map[name];
|
|
31
43
|
if (cmd.commands.length > 0) {
|
|
32
44
|
return await selectCommand(cmd);
|
|
@@ -34,12 +46,17 @@ const selectCommand = async (parentCommand) => {
|
|
|
34
46
|
return cmd;
|
|
35
47
|
};
|
|
36
48
|
const setOptionValue = async (opt) => {
|
|
49
|
+
output_1.default.clearPreviousLine();
|
|
50
|
+
let name = opt.name();
|
|
51
|
+
const desc = opt.description;
|
|
52
|
+
if (desc)
|
|
53
|
+
name += ` (${desc})`;
|
|
37
54
|
if (opt.isBoolean()) {
|
|
38
|
-
const val = await output_1.default.inputMenu(
|
|
55
|
+
const val = await output_1.default.inputMenu(`--${name}`, ['true', 'false']);
|
|
39
56
|
return val === 0;
|
|
40
57
|
}
|
|
41
58
|
else {
|
|
42
|
-
return await output_1.default.inputString(
|
|
59
|
+
return await output_1.default.inputString(`--${name}:`, opt.defaultValue);
|
|
43
60
|
}
|
|
44
61
|
};
|
|
45
62
|
const nameToCamelCase = (name) => {
|
|
@@ -66,18 +83,19 @@ const selectOptions = async (cmd) => {
|
|
|
66
83
|
const name = opt.name();
|
|
67
84
|
map[name] = opt;
|
|
68
85
|
items.push({
|
|
69
|
-
name
|
|
86
|
+
name: `--${name}`,
|
|
70
87
|
description: opt.description,
|
|
71
88
|
value: name,
|
|
72
89
|
});
|
|
73
90
|
});
|
|
74
91
|
items = items.sort((a, b) => a.name.localeCompare(b.name));
|
|
75
92
|
items.unshift({
|
|
76
|
-
name: '
|
|
93
|
+
name: 'Skip options',
|
|
77
94
|
value: '',
|
|
78
95
|
});
|
|
79
96
|
while (true) {
|
|
80
|
-
|
|
97
|
+
output_1.default.clearPreviousLine();
|
|
98
|
+
const name = await output_1.default.inputMenuAdv(getFinalCommand(cmd, options, []), items);
|
|
81
99
|
if (map[name]) {
|
|
82
100
|
const opt = map[name];
|
|
83
101
|
const value = await setOptionValue(opt);
|
|
@@ -108,6 +126,7 @@ const selectArguments = async (cmd) => {
|
|
|
108
126
|
if (arg.description)
|
|
109
127
|
desc += ` - ${arg.description}`;
|
|
110
128
|
desc += ':';
|
|
129
|
+
output_1.default.clearPreviousLine();
|
|
111
130
|
const value = await output_1.default.inputString(`${desc[0].toUpperCase()}${desc.substring(1)}`, arg.defaultValue, arg.required);
|
|
112
131
|
if (arg.variadic) {
|
|
113
132
|
args.push(value.split(' '));
|
|
@@ -119,7 +138,7 @@ const selectArguments = async (cmd) => {
|
|
|
119
138
|
}
|
|
120
139
|
return args;
|
|
121
140
|
};
|
|
122
|
-
const
|
|
141
|
+
const getFinalCommand = (cmd, options, args) => {
|
|
123
142
|
let txt = '';
|
|
124
143
|
let c = cmd;
|
|
125
144
|
while (c !== null) {
|
|
@@ -152,8 +171,7 @@ const outputFinalCommand = (cmd, options, args) => {
|
|
|
152
171
|
txt += ` "${arg}"`;
|
|
153
172
|
}
|
|
154
173
|
});
|
|
155
|
-
|
|
156
|
-
output_1.default.normal(txt);
|
|
174
|
+
return txt;
|
|
157
175
|
};
|
|
158
176
|
const main = async (program) => {
|
|
159
177
|
if (!output_1.default.isTTY()) {
|
|
@@ -164,7 +182,9 @@ const main = async (program) => {
|
|
|
164
182
|
const options = await selectOptions(cmd);
|
|
165
183
|
const args = await selectArguments(cmd);
|
|
166
184
|
Object.entries(options).forEach(([k, v]) => cmd.setOptionValue(camelCaseToName(k), v));
|
|
167
|
-
|
|
185
|
+
output_1.default.clearPreviousLine();
|
|
186
|
+
output_1.default.cyan('❯ ', false);
|
|
187
|
+
output_1.default.normal(getFinalCommand(cmd, options, args));
|
|
168
188
|
await cmd._actionHandler([...args, options, cmd]);
|
|
169
189
|
};
|
|
170
190
|
exports.default = main;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bdy",
|
|
3
3
|
"preferGlobal": false,
|
|
4
|
-
"version": "1.18.
|
|
4
|
+
"version": "1.18.22-dev",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {
|
|
@@ -66,7 +66,6 @@
|
|
|
66
66
|
"range-parser": "1.2.1",
|
|
67
67
|
"socket.io-client": "4.7.5",
|
|
68
68
|
"ssh2": "1.15.0",
|
|
69
|
-
"tabtab": "3.0.2",
|
|
70
69
|
"tar-stream": "3.1.7",
|
|
71
70
|
"terminal-kit": "3.1.1",
|
|
72
71
|
"undici": "6.23.0",
|
|
@@ -96,7 +95,6 @@
|
|
|
96
95
|
"@types/punycode": "2.1.4",
|
|
97
96
|
"@types/range-parser": "1.2.1",
|
|
98
97
|
"@types/ssh2": "1.15.5",
|
|
99
|
-
"@types/tabtab": "3.0.2",
|
|
100
98
|
"@types/tar-stream": "3.1.4",
|
|
101
99
|
"@types/terminal-kit": "2.5.6",
|
|
102
100
|
"@types/unzipper": "0.10.11",
|