@aiot-toolkit/commander 2.0.3-beta.2 → 2.0.3-beta.4
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/README.md +8 -6
- package/lib/Command.js +12 -0
- package/lib/interface/IParam.d.ts +8 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -111,12 +111,14 @@ ParamType 分为4类,继承自IParam
|
|
|
111
111
|
|
|
112
112
|
参数基础结构
|
|
113
113
|
|
|
114
|
-
| 属性
|
|
115
|
-
|
|
|
116
|
-
| name
|
|
117
|
-
| description
|
|
118
|
-
| defaultValue
|
|
119
|
-
| enableInquirer
|
|
114
|
+
| 属性 | 描述 | 类型 | 必填 |
|
|
115
|
+
| ----------------- | ------------------------------------------- | ------- | ----- |
|
|
116
|
+
| name | 参数名称 | string | true |
|
|
117
|
+
| description | 参数描述 | string | true |
|
|
118
|
+
| defaultValue | 默认值 | any | false |
|
|
119
|
+
| enableInquirer | 是否启用交互式询问 | boolean | false |
|
|
120
|
+
| deprecated | 废弃的提示信息, 如果有值,表示此参数已废弃 | string | |
|
|
121
|
+
| deprecatedVersion | 废弃的版本号 | string | |
|
|
120
122
|
|
|
121
123
|
#### 1. InputParam
|
|
122
124
|
|
package/lib/Command.js
CHANGED
|
@@ -48,6 +48,7 @@ class Command {
|
|
|
48
48
|
instance.action((...args) => __awaiter(this, void 0, void 0, function* () {
|
|
49
49
|
let option = args[args.length - 2];
|
|
50
50
|
if (paramList) {
|
|
51
|
+
// 检查询问式参数
|
|
51
52
|
for (let item of paramList) {
|
|
52
53
|
const { name, enableInquirer } = item;
|
|
53
54
|
const cameName = shared_utils_1.StringUtil.hyphenedToCamel(name);
|
|
@@ -63,6 +64,17 @@ class Command {
|
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
66
|
}
|
|
67
|
+
// 检查弃用的参数
|
|
68
|
+
const deprecatedList = paramList.filter((item) => item.deprecated);
|
|
69
|
+
deprecatedList.forEach((item) => {
|
|
70
|
+
const { name } = item;
|
|
71
|
+
const cameName = shared_utils_1.StringUtil.hyphenedToCamel(name);
|
|
72
|
+
if (option.hasOwnProperty(cameName)) {
|
|
73
|
+
shared_utils_1.ColorConsole.warn({ word: item.name }, 'is deprecated', ...(item.deprecatedVersion
|
|
74
|
+
? [', will be removed in version:', { word: item.deprecatedVersion }]
|
|
75
|
+
: []), '.', { word: item.deprecated || '' });
|
|
76
|
+
}
|
|
77
|
+
});
|
|
66
78
|
}
|
|
67
79
|
yield action.apply(null, args);
|
|
68
80
|
if (waiter) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiot-toolkit/commander",
|
|
3
|
-
"version": "2.0.3-beta.
|
|
3
|
+
"version": "2.0.3-beta.4",
|
|
4
4
|
"description": "A tool that generates complete commands with configuration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aiot",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"test": "node ./__tests__/commander.test.js"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@aiot-toolkit/shared-utils": "2.0.3-beta.
|
|
23
|
+
"@aiot-toolkit/shared-utils": "2.0.3-beta.4",
|
|
24
24
|
"@inquirer/prompts": "^3.0.3",
|
|
25
25
|
"chalk": "^4.0.0",
|
|
26
26
|
"commander": "^11.0.0"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "a79707d6a498ab01ac10ff3ba23d6271e2ac2ed8"
|
|
29
29
|
}
|