cnb-rs config set
cnb-rs config set <key> <value>设置配置项的值并写入 ~/.cnb/config.toml。对齐 gh config set。
如果配置文件或其父目录不存在会自动创建。嵌套 key(如 templates.*)首次设置时会自动创建 [templates] 段。
参数
<key>: 配置项名称。可选值:domaingit_protocol(仅接受https,传ssh会 friendly bail)templates.gitignore_repo(嵌套 key)templates.license_repo(嵌套 key)
<value>: 配置项的值
示例
bash
# 设置域名
$ cnb-rs config set domain cnb.cool
✓ domain = cnb.cool
# 切换 gitignore 模板镜像仓库
$ cnb-rs config set templates.gitignore_repo cnb/skills/gitignore-templates
✓ templates.gitignore_repo = cnb/skills/gitignore-templates
# 同时写入两个 templates.* 会自动合并到同一个 [templates] 段
$ cnb-rs config set templates.license_repo cnb/skills/license-templates
✓ templates.license_repo = cnb/skills/license-templates
# git_protocol 仅接受 https(CNB 暂不支持 SSH 克隆)
$ cnb-rs config set git_protocol ssh
错误: CNB 暂不支持 SSH 克隆,git_protocol 当前仅支持 https
# 传入未知 key
$ cnb-rs config set foo bar
错误: 未知配置项:foo
可用配置项:domain, git_protocol, templates.gitignore_repo, templates.license_repo