@aiot-toolkit/commander 2.0.2-dev.7 → 2.0.2
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/lib/Command.js +3 -6
- package/lib/index.d.ts +8 -6
- package/lib/index.js +5 -4
- package/package.json +4 -3
package/lib/Command.js
CHANGED
|
@@ -8,11 +8,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const
|
|
12
|
+
const shared_utils_1 = require("@aiot-toolkit/shared-utils");
|
|
16
13
|
const prompts_1 = require("@inquirer/prompts");
|
|
17
14
|
const commander_1 = require("commander");
|
|
18
15
|
class Command {
|
|
@@ -53,7 +50,7 @@ class Command {
|
|
|
53
50
|
if (paramList) {
|
|
54
51
|
for (let item of paramList) {
|
|
55
52
|
const { name, enableInquirer } = item;
|
|
56
|
-
const cameName =
|
|
53
|
+
const cameName = shared_utils_1.StringUtil.hyphenedToCamel(name);
|
|
57
54
|
const valueSource = instance.getOptionValueSource(cameName);
|
|
58
55
|
const haveSet = valueSource && valueSource !== 'default';
|
|
59
56
|
// 如果启用询问,且未已显式设置值,则通过询问收集参数
|
|
@@ -82,7 +79,7 @@ class Command {
|
|
|
82
79
|
static collectParam(param) {
|
|
83
80
|
return __awaiter(this, void 0, void 0, function* () {
|
|
84
81
|
const { name, description, type, defaultValue } = param;
|
|
85
|
-
const cameName =
|
|
82
|
+
const cameName = shared_utils_1.StringUtil.hyphenedToCamel(name);
|
|
86
83
|
let result;
|
|
87
84
|
switch (type) {
|
|
88
85
|
case 'string':
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import Command from './Command';
|
|
2
|
+
import ICommand from './interface/ICommand';
|
|
3
|
+
import IParam from './interface/IParam';
|
|
4
|
+
import IProgram from './interface/IProgram';
|
|
5
|
+
import IPersistentCommandData from './persistentCommand/IPersistentCommandData';
|
|
6
|
+
import PersistentCommand from './persistentCommand/PersistentCommand';
|
|
7
|
+
export default Command;
|
|
8
|
+
export { Command, ICommand, IParam, IPersistentCommandData, IProgram, PersistentCommand };
|
package/lib/index.js
CHANGED
|
@@ -4,7 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.PersistentCommand = exports.Command = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
const Command_1 = __importDefault(require("./Command"));
|
|
8
|
+
exports.Command = Command_1.default;
|
|
9
|
+
const PersistentCommand_1 = __importDefault(require("./persistentCommand/PersistentCommand"));
|
|
10
|
+
exports.PersistentCommand = PersistentCommand_1.default;
|
|
11
|
+
exports.default = Command_1.default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiot-toolkit/commander",
|
|
3
|
-
"version": "2.0.2
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "A tool that generates complete commands with configuration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aiot",
|
|
@@ -20,9 +20,10 @@
|
|
|
20
20
|
"test": "node ./__tests__/commander.test.js"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@aiot-toolkit/shared-utils": "2.0.2
|
|
23
|
+
"@aiot-toolkit/shared-utils": "2.0.2",
|
|
24
24
|
"@inquirer/prompts": "^3.0.3",
|
|
25
|
+
"chalk": "^4.0.0",
|
|
25
26
|
"commander": "^11.0.0"
|
|
26
27
|
},
|
|
27
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "8ca4bf2ed7bcf11911e5c514696951bdba4fc12d"
|
|
28
29
|
}
|