-
Notifications
You must be signed in to change notification settings - Fork 308
Description
Bug Summary
The xueqiu search command rejects --keyword as an argument, throwing error: unknown option '--keyword', while the bilibili search command accepts --keyword without issue. This creates a confusing and inconsistent user experience across opencli subcommands.
Steps to Reproduce
# This works (bilibili)
opencli bilibili search --keyword "特斯拉"
# This fails (xueqiu)
opencli xueqiu search --keyword "特斯拉"
# error: unknown option '--keyword'Expected Behavior
Both bilibili search and xueqiu search should accept --keyword as the primary search argument, maintaining consistency with each other and with users' mental model from other CLI tools (grep --keyword, curl --keyword, etc.).
Root Cause Analysis
File: src/clis/xueqiu/search.yaml
Root Cause: Inconsistent argument naming between xueqiu and bilibili CLIs.
xueqiu/search.yaml (uses query)
args:
query:
type: str
description: 搜索关键词,如 茅台、AAPL、腾讯bilibili/search.ts (uses keyword)
args: [
{ name: 'keyword', required: true, help: 'Search keyword' },
// ...
],The xueqiu CLI uses query as the argument name while bilibili uses keyword. The Commander.js parser correctly rejects --keyword for xueqiu because the argument name is query.
Impact
- User Experience: Forces users to remember different argument names per subcommand
- Expected: Consistent
--keywordacross all search commands - Workaround: Use
--queryfor xueqiu (not obvious from bilibili's interface)
Proposed Fix
Add keyword as an alias for the query argument in xueqiu/search.yaml:
args:
query:
type: str
aliases: [keyword] # Add this line
description: 搜索关键词,如 茅台、AAPL、腾讯This preserves backward compatibility for any existing scripts using --query while accepting the more intuitive --keyword flag.
Environment
- OpenCLI Version: 1.0.6
- Node.js: 22.x
- OS: Windows (confirmed), likely all platforms
Additional Context
The issue was confirmed when a user tried opencli bilibili search --keyword (works) followed by opencli xueqiu search --keyword (fails), demonstrating the inconsistency.