botrun-horse 2.28.3 → 2.28.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/bh.mjs +5 -0
- package/lib/core/cli-utils.mjs +4 -1
- package/package.json +1 -1
package/bin/bh.mjs
CHANGED
|
@@ -16,6 +16,11 @@ import { COMMANDS } from './commands/schema.mjs';
|
|
|
16
16
|
|
|
17
17
|
const { command, subcommand, flags, positionals } = parseArgs(process.argv);
|
|
18
18
|
|
|
19
|
+
// ===== Version =====
|
|
20
|
+
if (flags.version || command === '--version' || command === '-V') {
|
|
21
|
+
process.stdout.write(`${VERSION}\n`); process.exit(0);
|
|
22
|
+
}
|
|
23
|
+
|
|
19
24
|
// ===== Help 快速路由 =====
|
|
20
25
|
if (flags.help && !command) {
|
|
21
26
|
const { showHelp } = await import('./commands/help.mjs');
|
package/lib/core/cli-utils.mjs
CHANGED
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
import fs from 'fs';
|
|
5
5
|
import path from 'path';
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
6
7
|
|
|
7
|
-
const
|
|
8
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
const pkg = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../../package.json'), 'utf-8'));
|
|
10
|
+
const VERSION = pkg.version;
|
|
8
11
|
|
|
9
12
|
// 支援的文件副檔名(doc 系列指令)
|
|
10
13
|
const DOC_EXTS = new Set(['.pdf', '.docx', '.doc', '.odt', '.pptx', '.ppt', '.odp', '.xlsx', '.xls', '.ods', '.txt', '.md', '.rst']);
|