@aiot-toolkit/commander 2.0.3-beta.1 → 2.0.3-beta.10
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 +165 -104
- package/lib/index.js +49 -10
- package/lib/interface/ICommand.js +1 -2
- package/lib/interface/IParam.d.ts +8 -0
- package/lib/interface/IParam.js +4 -1
- package/lib/interface/IProgram.js +4 -1
- package/lib/persistentCommand/IPersistentCommandData.js +4 -1
- package/lib/persistentCommand/PersistentCommand.js +89 -88
- 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
|
@@ -1,113 +1,174 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const shared_utils_1 = require("@aiot-toolkit/shared-utils");
|
|
13
|
-
const prompts_1 = require("@inquirer/prompts");
|
|
14
|
-
const commander_1 = require("commander");
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _sharedUtils = require("@aiot-toolkit/shared-utils");
|
|
8
|
+
var _prompts = require("@inquirer/prompts");
|
|
9
|
+
var _commander = require("commander");
|
|
15
10
|
class Command {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
11
|
+
/**
|
|
12
|
+
* 注册命令行项目
|
|
13
|
+
* @param programConfig 配置
|
|
14
|
+
*/
|
|
15
|
+
static registeProgram(programConfig) {
|
|
16
|
+
const {
|
|
17
|
+
name,
|
|
18
|
+
description,
|
|
19
|
+
version,
|
|
20
|
+
commandList,
|
|
21
|
+
defaultCommand
|
|
22
|
+
} = programConfig;
|
|
23
|
+
_commander.program.name(name).description(description).version(version, '-v, --version');
|
|
24
|
+
if (defaultCommand) {
|
|
25
|
+
this.registeCommand(defaultCommand);
|
|
26
|
+
}
|
|
27
|
+
if (commandList) {
|
|
28
|
+
commandList.forEach(item => {
|
|
29
|
+
Command.registeCommand(item);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
_commander.program.parse();
|
|
33
|
+
}
|
|
34
|
+
static registeCommand(command) {
|
|
35
|
+
var _this = this;
|
|
36
|
+
const {
|
|
37
|
+
name,
|
|
38
|
+
description,
|
|
39
|
+
argumentList,
|
|
40
|
+
action,
|
|
41
|
+
paramList,
|
|
42
|
+
waiter
|
|
43
|
+
} = command;
|
|
44
|
+
const instance = name ? _commander.program.command(name).description(description) : _commander.program;
|
|
45
|
+
|
|
46
|
+
// 设置argument
|
|
47
|
+
argumentList?.forEach(item => {
|
|
48
|
+
const {
|
|
49
|
+
name,
|
|
50
|
+
description,
|
|
51
|
+
defaultValue
|
|
52
|
+
} = item;
|
|
53
|
+
instance.argument(name, description, defaultValue);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// 设置option
|
|
57
|
+
paramList?.forEach(item => {
|
|
58
|
+
const {
|
|
59
|
+
type,
|
|
60
|
+
name,
|
|
61
|
+
description,
|
|
62
|
+
defaultValue
|
|
63
|
+
} = item;
|
|
64
|
+
const effectName = type === 'confirm' ? `--${name}` : `--${name} <value>`;
|
|
65
|
+
instance.option(effectName, description, defaultValue);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// 设置交互式问题
|
|
69
|
+
instance.action(async function () {
|
|
70
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
71
|
+
args[_key] = arguments[_key];
|
|
72
|
+
}
|
|
73
|
+
let option = args[args.length - 2];
|
|
74
|
+
if (paramList) {
|
|
75
|
+
// 检查询问式参数
|
|
76
|
+
for (let item of paramList) {
|
|
77
|
+
const {
|
|
78
|
+
name,
|
|
79
|
+
enableInquirer
|
|
80
|
+
} = item;
|
|
81
|
+
const cameName = _sharedUtils.StringUtil.hyphenedToCamel(name);
|
|
82
|
+
const valueSource = instance.getOptionValueSource(cameName);
|
|
83
|
+
const haveSet = valueSource && valueSource !== 'default';
|
|
84
|
+
// 如果启用询问,且未已显式设置值,则通过询问收集参数
|
|
85
|
+
if (enableInquirer && !haveSet) {
|
|
86
|
+
const result = await _this.collectParam(item);
|
|
87
|
+
if (result) {
|
|
88
|
+
for (let key in result) {
|
|
89
|
+
option[key] = result[key];
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
25
93
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
94
|
+
|
|
95
|
+
// 检查弃用的参数
|
|
96
|
+
const deprecatedList = paramList.filter(item => item.deprecated);
|
|
97
|
+
deprecatedList.forEach(item => {
|
|
98
|
+
const {
|
|
99
|
+
name
|
|
100
|
+
} = item;
|
|
101
|
+
const cameName = _sharedUtils.StringUtil.hyphenedToCamel(name);
|
|
102
|
+
if (option.hasOwnProperty(cameName)) {
|
|
103
|
+
_sharedUtils.ColorConsole.warn({
|
|
104
|
+
word: item.name
|
|
105
|
+
}, 'is deprecated', ...(item.deprecatedVersion ? [', will be removed in version:', {
|
|
106
|
+
word: item.deprecatedVersion
|
|
107
|
+
}] : []), '.', {
|
|
108
|
+
word: item.deprecated || ''
|
|
29
109
|
});
|
|
30
|
-
|
|
31
|
-
commander_1.program.parse();
|
|
32
|
-
}
|
|
33
|
-
static registeCommand(command) {
|
|
34
|
-
const { name, description, argumentList, action, paramList, waiter } = command;
|
|
35
|
-
const instance = name ? commander_1.program.command(name).description(description) : commander_1.program;
|
|
36
|
-
// 设置argument
|
|
37
|
-
argumentList === null || argumentList === void 0 ? void 0 : argumentList.forEach((item) => {
|
|
38
|
-
const { name, description, defaultValue } = item;
|
|
39
|
-
instance.argument(name, description, defaultValue);
|
|
110
|
+
}
|
|
40
111
|
});
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
112
|
+
}
|
|
113
|
+
await action.apply(null, args);
|
|
114
|
+
if (waiter) {
|
|
115
|
+
waiter.describe();
|
|
116
|
+
waiter.start();
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* 采集参数。 根据不同的参数类型使用不同的询问方式
|
|
123
|
+
* @param param
|
|
124
|
+
* @returns
|
|
125
|
+
*/
|
|
126
|
+
static async collectParam(param) {
|
|
127
|
+
const {
|
|
128
|
+
name,
|
|
129
|
+
description,
|
|
130
|
+
type,
|
|
131
|
+
defaultValue
|
|
132
|
+
} = param;
|
|
133
|
+
const cameName = _sharedUtils.StringUtil.hyphenedToCamel(name);
|
|
134
|
+
let result;
|
|
135
|
+
switch (type) {
|
|
136
|
+
case 'string':
|
|
137
|
+
const {
|
|
138
|
+
validate
|
|
139
|
+
} = param;
|
|
140
|
+
result = await (0, _prompts.input)({
|
|
141
|
+
message: description,
|
|
142
|
+
default: defaultValue?.toString(),
|
|
143
|
+
...(validate ? {
|
|
144
|
+
validate
|
|
145
|
+
} : {})
|
|
46
146
|
});
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
yield action.apply(null, args);
|
|
68
|
-
if (waiter) {
|
|
69
|
-
waiter.describe();
|
|
70
|
-
waiter.start();
|
|
71
|
-
}
|
|
72
|
-
}));
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* 采集参数。 根据不同的参数类型使用不同的询问方式
|
|
76
|
-
* @param param
|
|
77
|
-
* @returns
|
|
78
|
-
*/
|
|
79
|
-
static collectParam(param) {
|
|
80
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
-
const { name, description, type, defaultValue } = param;
|
|
82
|
-
const cameName = shared_utils_1.StringUtil.hyphenedToCamel(name);
|
|
83
|
-
let result;
|
|
84
|
-
switch (type) {
|
|
85
|
-
case 'string':
|
|
86
|
-
const { validate } = param;
|
|
87
|
-
result = yield (0, prompts_1.input)(Object.assign({ message: description, default: defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.toString() }, (validate ? { validate } : {})));
|
|
88
|
-
break;
|
|
89
|
-
case 'confirm':
|
|
90
|
-
result = yield (0, prompts_1.confirm)({ message: description, default: Boolean(defaultValue) });
|
|
91
|
-
break;
|
|
92
|
-
case 'select':
|
|
93
|
-
result = yield (0, prompts_1.select)({
|
|
94
|
-
message: description,
|
|
95
|
-
choices: param.choices
|
|
96
|
-
});
|
|
97
|
-
break;
|
|
98
|
-
case 'checkbox':
|
|
99
|
-
result = yield (0, prompts_1.checkbox)({
|
|
100
|
-
message: description,
|
|
101
|
-
choices: param.choices
|
|
102
|
-
});
|
|
103
|
-
break;
|
|
104
|
-
default:
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
return {
|
|
108
|
-
[cameName]: result
|
|
109
|
-
};
|
|
147
|
+
break;
|
|
148
|
+
case 'confirm':
|
|
149
|
+
result = await (0, _prompts.confirm)({
|
|
150
|
+
message: description,
|
|
151
|
+
default: Boolean(defaultValue)
|
|
152
|
+
});
|
|
153
|
+
break;
|
|
154
|
+
case 'select':
|
|
155
|
+
result = await (0, _prompts.select)({
|
|
156
|
+
message: description,
|
|
157
|
+
choices: param.choices
|
|
158
|
+
});
|
|
159
|
+
break;
|
|
160
|
+
case 'checkbox':
|
|
161
|
+
result = await (0, _prompts.checkbox)({
|
|
162
|
+
message: description,
|
|
163
|
+
choices: param.choices
|
|
110
164
|
});
|
|
165
|
+
break;
|
|
166
|
+
default:
|
|
167
|
+
break;
|
|
111
168
|
}
|
|
169
|
+
return {
|
|
170
|
+
[cameName]: result
|
|
171
|
+
};
|
|
172
|
+
}
|
|
112
173
|
}
|
|
113
|
-
exports.default = Command;
|
|
174
|
+
var _default = exports.default = Command;
|
package/lib/index.js
CHANGED
|
@@ -1,11 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Command", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _Command.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "ICommand", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _ICommand.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "IParam", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _IParam.default;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "IPersistentCommandData", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _IPersistentCommandData.default;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "IProgram", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _IProgram.default;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "PersistentCommand", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _PersistentCommand.default;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
exports.default = void 0;
|
|
43
|
+
var _Command = _interopRequireDefault(require("./Command"));
|
|
44
|
+
var _ICommand = _interopRequireDefault(require("./interface/ICommand"));
|
|
45
|
+
var _IParam = _interopRequireDefault(require("./interface/IParam"));
|
|
46
|
+
var _IProgram = _interopRequireDefault(require("./interface/IProgram"));
|
|
47
|
+
var _IPersistentCommandData = _interopRequireDefault(require("./persistentCommand/IPersistentCommandData"));
|
|
48
|
+
var _PersistentCommand = _interopRequireDefault(require("./persistentCommand/PersistentCommand"));
|
|
49
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
50
|
+
var _default = exports.default = _Command.default;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
package/lib/interface/IParam.js
CHANGED
|
@@ -1,97 +1,98 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _chalk = _interopRequireDefault(require("chalk"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
9
|
const CTRL_C = '\u0003';
|
|
17
10
|
const CTRL_L = '\u000C';
|
|
18
11
|
const BLT = '\u203A';
|
|
19
12
|
class PersistentCommand {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
break;
|
|
29
|
-
case CTRL_L:
|
|
30
|
-
this.clearLog();
|
|
31
|
-
break;
|
|
32
|
-
default:
|
|
33
|
-
if (this.actionRunning) {
|
|
34
|
-
console.log(chalk_1.default.yellow(`Wait for the task to complete`));
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
const item = this.data.options.find((item) => item.key === data);
|
|
38
|
-
if (item) {
|
|
39
|
-
this.actionRunning = true;
|
|
40
|
-
try {
|
|
41
|
-
yield item.action();
|
|
42
|
-
}
|
|
43
|
-
catch (error) {
|
|
44
|
-
console.error(error);
|
|
45
|
-
}
|
|
46
|
-
this.actionRunning = false;
|
|
47
|
-
}
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
});
|
|
13
|
+
running = false;
|
|
14
|
+
actionRunning = false;
|
|
15
|
+
constructor(data) {
|
|
16
|
+
this.data = data;
|
|
17
|
+
}
|
|
18
|
+
start() {
|
|
19
|
+
if (this.running) {
|
|
20
|
+
return;
|
|
51
21
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
22
|
+
const {
|
|
23
|
+
stdin
|
|
24
|
+
} = process;
|
|
25
|
+
stdin.setRawMode(true);
|
|
26
|
+
stdin.resume();
|
|
27
|
+
stdin.setEncoding('utf8');
|
|
28
|
+
stdin.on('data', this.dataHandler);
|
|
29
|
+
this.running = true;
|
|
30
|
+
}
|
|
31
|
+
dataHandler = async data => {
|
|
32
|
+
switch (data) {
|
|
33
|
+
case CTRL_C:
|
|
34
|
+
process.exit();
|
|
35
|
+
break;
|
|
36
|
+
case CTRL_L:
|
|
37
|
+
this.clearLog();
|
|
38
|
+
break;
|
|
39
|
+
default:
|
|
40
|
+
if (this.actionRunning) {
|
|
41
|
+
console.log(_chalk.default.yellow(`Wait for the task to complete`));
|
|
42
|
+
return;
|
|
55
43
|
}
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
stdin.resume();
|
|
68
|
-
this.running = false;
|
|
69
|
-
}
|
|
70
|
-
writeLine() {
|
|
71
|
-
const str = new Array(30)
|
|
72
|
-
.fill(0)
|
|
73
|
-
.map(() => '-')
|
|
74
|
-
.join('');
|
|
75
|
-
console.log(chalk_1.default.dim(str));
|
|
76
|
-
}
|
|
77
|
-
describe() {
|
|
78
|
-
const { description, options } = this.data;
|
|
79
|
-
this.writeLine();
|
|
80
|
-
// 输出描述
|
|
81
|
-
console.log(chalk_1.default.green(description));
|
|
82
|
-
console.log('');
|
|
83
|
-
// 输出命令列表
|
|
84
|
-
options.forEach((item) => {
|
|
85
|
-
const { key, description } = item;
|
|
86
|
-
console.log(`${BLT} ${chalk_1.default.bold(key)} | ${description}`);
|
|
87
|
-
});
|
|
88
|
-
// 输出退出的方法
|
|
89
|
-
console.log();
|
|
90
|
-
console.log(chalk_1.default.dim(`Press Ctrl+C to exit.`));
|
|
91
|
-
this.writeLine();
|
|
92
|
-
}
|
|
93
|
-
clearLog() {
|
|
94
|
-
process.stdout.write(process.platform === 'win32' ? '\x1B[2J\x1B[0f' : '\x1B[2J\x1B[3J\x1B[H');
|
|
44
|
+
const item = this.data.options.find(item => item.key === data);
|
|
45
|
+
if (item) {
|
|
46
|
+
this.actionRunning = true;
|
|
47
|
+
try {
|
|
48
|
+
await item.action();
|
|
49
|
+
} catch (error) {
|
|
50
|
+
console.error(error);
|
|
51
|
+
}
|
|
52
|
+
this.actionRunning = false;
|
|
53
|
+
}
|
|
54
|
+
break;
|
|
95
55
|
}
|
|
56
|
+
};
|
|
57
|
+
stop() {
|
|
58
|
+
const {
|
|
59
|
+
stdin
|
|
60
|
+
} = process;
|
|
61
|
+
stdin.removeListener('data', this.dataHandler);
|
|
62
|
+
stdin.setRawMode(false);
|
|
63
|
+
stdin.resume();
|
|
64
|
+
this.running = false;
|
|
65
|
+
}
|
|
66
|
+
writeLine() {
|
|
67
|
+
const str = new Array(30).fill(0).map(() => '-').join('');
|
|
68
|
+
console.log(_chalk.default.dim(str));
|
|
69
|
+
}
|
|
70
|
+
describe() {
|
|
71
|
+
const {
|
|
72
|
+
description,
|
|
73
|
+
options
|
|
74
|
+
} = this.data;
|
|
75
|
+
this.writeLine();
|
|
76
|
+
// 输出描述
|
|
77
|
+
console.log(_chalk.default.green(description));
|
|
78
|
+
console.log('');
|
|
79
|
+
|
|
80
|
+
// 输出命令列表
|
|
81
|
+
options.forEach(item => {
|
|
82
|
+
const {
|
|
83
|
+
key,
|
|
84
|
+
description
|
|
85
|
+
} = item;
|
|
86
|
+
console.log(`${BLT} ${_chalk.default.bold(key)} | ${description}`);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// 输出退出的方法
|
|
90
|
+
console.log();
|
|
91
|
+
console.log(_chalk.default.dim(`Press Ctrl+C to exit.`));
|
|
92
|
+
this.writeLine();
|
|
93
|
+
}
|
|
94
|
+
clearLog() {
|
|
95
|
+
process.stdout.write(process.platform === 'win32' ? '\x1B[2J\x1B[0f' : '\x1B[2J\x1B[3J\x1B[H');
|
|
96
|
+
}
|
|
96
97
|
}
|
|
97
|
-
exports.default = PersistentCommand;
|
|
98
|
+
var _default = exports.default = PersistentCommand;
|
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.10",
|
|
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.10",
|
|
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": "e591934b19bc474453ce11b63f0c8bb0d8eb8bd9"
|
|
29
29
|
}
|