6aspec 2.0.0-dev.3 → 2.0.0-dev.6
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/bin/6aspec +17 -1
- package/package.json +1 -1
package/bin/6aspec
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const path = require('path');
|
|
4
|
+
const pkg = require('../package.json');
|
|
4
5
|
const cli = require('../lib/cli');
|
|
5
6
|
|
|
6
7
|
const args = process.argv.slice(2);
|
|
@@ -8,7 +9,7 @@ const command = args[0];
|
|
|
8
9
|
|
|
9
10
|
if (!command || command === '--help' || command === '-h') {
|
|
10
11
|
console.log(`
|
|
11
|
-
\x1b[36m6Aspec\x1b[0m - 轻量级 spec 驱动开发框架
|
|
12
|
+
\x1b[36m6Aspec\x1b[0m v${pkg.version} - 轻量级 spec 驱动开发框架
|
|
12
13
|
|
|
13
14
|
用法:
|
|
14
15
|
6aspec <command>
|
|
@@ -16,6 +17,7 @@ if (!command || command === '--help' || command === '-h') {
|
|
|
16
17
|
命令:
|
|
17
18
|
init 交互式初始化(选择工具 + 安装配置)
|
|
18
19
|
update 更新已安装的工具配置(merge 模式)
|
|
20
|
+
version 显示当前 CLI 版本
|
|
19
21
|
--help 显示帮助信息
|
|
20
22
|
|
|
21
23
|
示例:
|
|
@@ -27,6 +29,20 @@ if (!command || command === '--help' || command === '-h') {
|
|
|
27
29
|
process.exit(0);
|
|
28
30
|
}
|
|
29
31
|
|
|
32
|
+
if (command === '--version' || command === '-v' || command === 'version') {
|
|
33
|
+
const fs = require('fs');
|
|
34
|
+
const configPath = path.join(process.cwd(), '.6aspec/init.json');
|
|
35
|
+
let projectInfo = '';
|
|
36
|
+
if (fs.existsSync(configPath)) {
|
|
37
|
+
try {
|
|
38
|
+
const cfg = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
39
|
+
projectInfo = `\n\x1b[2m 当前项目已安装: ${cfg.tools.join(', ')} (版本 ${cfg.version || 'unknown'})\x1b[0m`;
|
|
40
|
+
} catch {}
|
|
41
|
+
}
|
|
42
|
+
console.log(`\x1b[36m6Aspec\x1b[0m v${pkg.version}${projectInfo}`);
|
|
43
|
+
process.exit(0);
|
|
44
|
+
}
|
|
45
|
+
|
|
30
46
|
(async () => {
|
|
31
47
|
try {
|
|
32
48
|
switch (command) {
|