Skip to content

Feature bash_completion for bash-base linux.#349

Merged
ccmywish merged 2 commits intodevfrom
feature_bashcompletion
Mar 23, 2026
Merged

Feature bash_completion for bash-base linux.#349
ccmywish merged 2 commits intodevfrom
feature_bashcompletion

Conversation

@Gchuchu
Copy link
Collaborator

@Gchuchu Gchuchu commented Mar 23, 2026

Feature内容:

  1. 添加了Linux bash的补全脚本
  2. 增加了构建deb包,安装时将补全脚本添加至用户环境中usr/share/bash-completion/completions/

补全脚本说明

#204 更多说明请参考此issue

chsrc_completion.sh流程说明

  1. 用户按下Tab,会自动拦截并执行一次脚本逻辑

  2. 取得划分好的单词数组,以及当前正在输入的部分。

  3. 手动获取单词内容,因为包含了-dry等选项,所以需要区分选项和子命令

  4. 根据命令或选项填充COMPREPLY

  5. COMPREPLY会自动反馈给用户终端

使用说明

方法一:

  1. 安装chsrc,使得可以直接通过chsrc命令访问,参考README.md安装部分
  2. chsrc仓库feature_bashcompletion分支根目录引入配置文件
git checkout -b feature_bashcompletion origin/feature_bashcompletion
source tool/completion/bash_completion.sh

方法二:

  1. 构建deb包并安装,参考https://github.com/RubyMetric/chsrc/tree/main/pkg/deb 的构建说明。
  2. 新开终端体验(安装完成后补全逻辑不会立即生效,其他软件也是如此)

@Gchuchu Gchuchu self-assigned this Mar 23, 2026
@github-actions
Copy link

Hi @Gchuchu

❤️ 感谢你的贡献!我们将在最少半小时,最多5天内阅读此 PR 并回复你

@ccmywish ccmywish added this to the v0.2.5 milestone Mar 23, 2026
@ccmywish ccmywish added 改善加强 改善加强 Linux Linux相关 labels Mar 23, 2026
@ccmywish ccmywish merged commit 0038d6f into dev Mar 23, 2026
2 checks passed
@ccmywish
Copy link
Contributor

👍👍👍

@Gchuchu Gchuchu deleted the feature_bashcompletion branch March 24, 2026 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Linux Linux相关 改善加强 改善加强

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants