cnb-rs label create
cnb-rs label create <name> [-c <hex>] [-d <text>] [-f]创建仓库标签。对齐 gh label create。
参数
<name>: 标签名称(位置参数,必填)
选项
-c, --color <HEX>: 颜色,十六进制格式不含#。未指定时随机生成一个鲜艳色(避免太暗低于0x55)-d, --description <TEXT>: 标签描述-f, --force: 标签已存在时改为更新其 color/description,而不是报 HTTP 409 错误
继承的全局选项:
--repo <REPO>: 指定仓库路径(格式:group/repo)--json: 以 JSON 格式输出--domain <DOMAIN>: 指定目标域名(默认:cnb.cool)
示例
bash
# 创建标签(随机色)
$ cnb-rs label create bug
✓ 标签 bug 已创建(color: a7c5e3)
# 指定色与描述
$ cnb-rs label create bug -c d73a4a -d "Bug 修复"
✓ 标签 bug 已创建(color: d73a4a)
# 同名标签重复 create 会失败
$ cnb-rs label create bug
错误: API 请求失败 (HTTP 409): {"errcode":409,"errmsg":"存在冲突"}
# 加 --force 自动转为更新
$ cnb-rs label create bug --force -c 0075ca -d "Bug 修复(覆写)"
标签 bug 已存在,--force 改为更新
✓ 标签 bug 已更新