From 20567a06e11b5069ece95c80d7f25c7d27c4af7d Mon Sep 17 00:00:00 2001 From: plat1ko Date: Sun, 22 Mar 2026 00:46:24 +0800 Subject: [PATCH] feat(xueqiu): make primary args positional MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - search: query → positional - stock: symbol → positional - earnings-date: symbol → positional - Fix build-manifest scanYaml to preserve positional field Usage: opencli xueqiu search '茅台' opencli xueqiu stock SH600519 opencli xueqiu earnings-date SH600519 --- src/build-manifest.ts | 1 + src/clis/xueqiu/earnings-date.yaml | 2 ++ src/clis/xueqiu/search.yaml | 3 ++- src/clis/xueqiu/stock.yaml | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/build-manifest.ts b/src/build-manifest.ts index ec32f417..6563abfe 100644 --- a/src/build-manifest.ts +++ b/src/build-manifest.ts @@ -173,6 +173,7 @@ function scanYaml(filePath: string, site: string): ManifestEntry | null { type: argDef?.type ?? 'str', default: argDef?.default, required: argDef?.required ?? false, + positional: argDef?.positional === true || undefined, help: argDef?.description ?? argDef?.help ?? '', choices: argDef?.choices, }); diff --git a/src/clis/xueqiu/earnings-date.yaml b/src/clis/xueqiu/earnings-date.yaml index 4afef8ae..e2147fe3 100644 --- a/src/clis/xueqiu/earnings-date.yaml +++ b/src/clis/xueqiu/earnings-date.yaml @@ -6,7 +6,9 @@ browser: true args: symbol: + positional: true type: str + required: true description: 股票代码,如 SH600519、SZ000858、00700 next: type: bool diff --git a/src/clis/xueqiu/search.yaml b/src/clis/xueqiu/search.yaml index ed7ab76c..b33974e2 100644 --- a/src/clis/xueqiu/search.yaml +++ b/src/clis/xueqiu/search.yaml @@ -6,7 +6,9 @@ browser: true args: query: + positional: true type: str + required: true description: 搜索关键词,如 茅台、AAPL、腾讯 limit: type: int @@ -19,7 +21,6 @@ pipeline: (async () => { const query = ${{ args.query | json }}; const count = ${{ args.limit }}; - if (!query) throw new Error('Missing argument: query'); const resp = await fetch(`https://xueqiu.com/stock/search.json?code=${encodeURIComponent(query)}&size=${count}`, {credentials: 'include'}); if (!resp.ok) throw new Error('HTTP ' + resp.status + ' Hint: Not logged in?'); const d = await resp.json(); diff --git a/src/clis/xueqiu/stock.yaml b/src/clis/xueqiu/stock.yaml index 45d09e4e..ab5f5791 100644 --- a/src/clis/xueqiu/stock.yaml +++ b/src/clis/xueqiu/stock.yaml @@ -6,7 +6,9 @@ browser: true args: symbol: + positional: true type: str + required: true description: 股票代码,如 SH600519、SZ000858、AAPL、00700 pipeline: