Skip to content

[feature]添加运行时模板 CLI 自动补全#229

Closed
fatsheep2 wants to merge 2 commits into
deb-sig:masterfrom
fatsheep2:codex/runtime-template-completion
Closed

[feature]添加运行时模板 CLI 自动补全#229
fatsheep2 wants to merge 2 commits into
deb-sig:masterfrom
fatsheep2:codex/runtime-template-completion

Conversation

@fatsheep2

Copy link
Copy Markdown
Contributor

Description

为运行时模板相关 CLI 增加 shell 自动补全能力,包括:

  • 新增 completion [bash|zsh|powershell] 子命令
  • importconfig inittemplate 等命令补充模板引用、版本、文件类型和输出格式补全
  • 升级 cobra 以使用新版 completion API

Motivation and Context

运行时模板会引入模板 ID、版本号、规则文件和输出目标等参数。自动补全可以降低命令行使用成本,尤其是模板版本 pinning 和个人规则文件路径场景。

Dependencies

  • 升级 github.com/spf13/cobrav1.10.2
  • 间接依赖随 go mod tidy 更新

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How has this been tested?

  • make check-format
  • go test ./pkg/cmd ./pkg/importer

Is this change properly documented?

自动补全作为 CLI 易用性增强,建议在核心模板 provider PR 合并后,在使用文档中补充一小段 completion 命令示例。

@fatsheep2 fatsheep2 requested review from a team, Triple-Z and gaocegege as code owners May 29, 2026 16:21
@gaocegege

Copy link
Copy Markdown
Member

35 万行,需要这么多代码么,害怕

@fatsheep2

Copy link
Copy Markdown
Contributor Author

35 万行,需要这么多代码么,害怕

+349,046 是jieba分词的那个dict.txt文件,之前的那个不知道为什么有问题了,我重新拉了一份结果成diff了

@fatsheep2 fatsheep2 force-pushed the codex/runtime-template-completion branch from d0198ee to 7c06095 Compare May 30, 2026 06:24
@fatsheep2 fatsheep2 closed this May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants