Skip to content

[Bug]: xueqiu search CLI error: --keyword unrecognized but bilibili search accepts --keyword (inconsistent argument naming) #136

@Financier-Nuri

Description

@Financier-Nuri

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 --keyword across all search commands
  • Workaround: Use --query for 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions