跳转到内容

cnb-rs config

查看或修改 cnb-rs 的配置项。对齐 gh config 的 list / get / set 主子命令,额外提供 unset 重置某个 key 到 default。

配置文件路径:~/.cnb/config.toml

当前支持的配置项

key含义默认
domainCNB 平台域名cnb.cool
git_protocolGit 克隆协议,当前仅接受 https 取值(CNB 暂不支持 SSH)https
templates.gitignore_reporepo gitignore 拉取模板的镜像仓库wwvo/cnb-rs/gitignore-templates
templates.license_reporepo license 拉取模板的镜像仓库wwvo/cnb-rs/license-templates

嵌套 key 用 . 分隔(参考 git config / gh config 惯例)。

可用命令

示例

bash
# 查看全部配置
$ cnb-rs config list
domain = cnb.cool (default)
git_protocol = https (default)
templates.gitignore_repo = wwvo/cnb-rs/gitignore-templates (default)
templates.license_repo = wwvo/cnb-rs/license-templates (default)

# 切换模板镜像仓库
$ cnb-rs config set templates.gitignore_repo cnb/skills/gitignore-templates
 templates.gitignore_repo = cnb/skills/gitignore-templates

# 不希望覆盖了 → unset 重置为默认
$ cnb-rs config unset templates.gitignore_repo
 已清除 templates.gitignore_repo

# JSON 输出供脚本消费
$ cnb-rs config list --json

与 gh 对照

能力gh configcnb-rs config
list (alias ls)
get✓ + --json
set✓ + 嵌套 key
unset✗(需 set "" 模拟)✓ 专门命令更清晰
clear-cache✗(cnb-rs 无 host-level cache,不需要)

另请参阅

Released under the MIT License.