verifact 0.2.2 → 0.2.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/bin/verifact.js +6 -0
- package/package.json +1 -1
package/bin/verifact.js
CHANGED
|
@@ -18,6 +18,7 @@ const HELP = `verifact — 事实哨兵:把文档里的硬数字声明绑定
|
|
|
18
18
|
verifact diff [--since <n>] [--top <n>] 对比两次运行之间的状态迁移
|
|
19
19
|
verifact serve [--config <file>] [--port <n>] 启动本地看板与 API
|
|
20
20
|
verifact init [--dir <dir>] 生成一份 verifact.json 样例配置
|
|
21
|
+
verifact --version | -v 打印版本号
|
|
21
22
|
|
|
22
23
|
verify 选项:
|
|
23
24
|
--cwd <dir> 配置文件查找 / 缓存 / --out 的基准目录,默认当前目录
|
|
@@ -46,6 +47,7 @@ function parseArgs(argv) {
|
|
|
46
47
|
while (i < argv.length) {
|
|
47
48
|
const a = argv[i];
|
|
48
49
|
if (a === '--help' || a === '-h') { out.flags.help = true; i++; continue; }
|
|
50
|
+
if (a === '-v') { out.flags.version = true; i++; continue; }
|
|
49
51
|
if (a.startsWith('--')) {
|
|
50
52
|
const key = a.slice(2);
|
|
51
53
|
const next = argv[i + 1];
|
|
@@ -433,6 +435,10 @@ function cmdInit(args) {
|
|
|
433
435
|
async function main() {
|
|
434
436
|
const rawArgv = process.argv.slice(2);
|
|
435
437
|
const args = parseArgs(rawArgv);
|
|
438
|
+
if (args.flags.version) {
|
|
439
|
+
process.stdout.write(require('../package.json').version + '\n');
|
|
440
|
+
return 0;
|
|
441
|
+
}
|
|
436
442
|
if (args.flags.help || !args._.length) {
|
|
437
443
|
process.stdout.write(HELP);
|
|
438
444
|
return args._.length ? 0 : 2;
|