@casatwy/deyo 0.1.1 → 0.1.3

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.
Files changed (3) hide show
  1. package/README.md +4 -0
  2. package/deyo.mjs +9 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -137,6 +137,10 @@ deyo --api-key 'deyo_sk_other' 'https://www.youtube.com/watch?v=xxxx'
137
137
  如果你已经执行过 `deyo auth login`,平时通常不需要再传。
138
138
  当它和本地已保存配置同时存在时,会优先使用这次命令里传入的 `--api-key`。
139
139
 
140
+ `-v, --version`
141
+
142
+ 打印当前 CLI 版本号并退出,适合快速确认本机装的是哪个版本。
143
+
140
144
  ## 在 AI 工具中使用
141
145
 
142
146
  如果你希望让 AI 助手在你的本机环境里调用 `deyo`,可以参考官方安装页:
package/deyo.mjs CHANGED
@@ -1,10 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { chmod, mkdir, readFile, rm, writeFile } from 'node:fs/promises'
4
+ import { createRequire } from 'node:module'
4
5
  import { dirname, extname, resolve } from 'node:path'
5
6
  import { homedir } from 'node:os'
6
7
  import process from 'node:process'
7
8
 
9
+ const CLI_VERSION = createRequire(import.meta.url)('./package.json').version
10
+
8
11
  const DEFAULT_BASE_URL = 'https://deyo.miaobi.fun'
9
12
  const DEFAULT_LANGUAGE = 'zh'
10
13
  const POLL_INTERVAL_MS = 1500
@@ -37,6 +40,7 @@ function printUsage() {
37
40
  --format <value> 可选,text | srt | vtt | json | verbose_json
38
41
  --base-url <url> 可选,默认 ${DEFAULT_BASE_URL}
39
42
  -h, --help 显示帮助
43
+ -v, --version 显示 CLI 版本
40
44
 
41
45
  auth 子命令:
42
46
  deyo auth login --api-key <key> [--base-url <url>]
@@ -825,6 +829,11 @@ async function main() {
825
829
  const argv = process.argv.slice(2)
826
830
  const primaryCommand = argv[0]
827
831
 
832
+ if (primaryCommand === '-v' || primaryCommand === '--version') {
833
+ process.stdout.write(`${CLI_VERSION}\n`)
834
+ return
835
+ }
836
+
828
837
  if (!primaryCommand || primaryCommand === '-h' || primaryCommand === '--help') {
829
838
  printUsage()
830
839
  return
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@casatwy/deyo",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "CLI for submitting Deyo transcription jobs from the terminal",
5
5
  "homepage": "https://deyo.miaobi.fun/docs",
6
6
  "license": "UNLICENSED",