cnb-rs repo file raw
cnb-rs repo file raw <REF> <PATH> [--max-bytes <N>]拉文件原始内容输出到 stdout(无额外格式 / 颜色 / header,便于重定向)。
参数
<REF>: 分支名 / commit sha / tag 名<PATH>: 文件路径
选项
--max-bytes <N>: 文件大小上限(默认 0 = 用 CNBgitConfig.RawFileLimitInByte默认值)
示例
bash
# 输出到 stdout
cnb-rs --repo wwvo/cnb-rs/cnb-rs repo file raw main Cargo.toml
# 重定向到本地
cnb-rs --repo wwvo/cnb-rs/cnb-rs repo file raw main README.md > README.md
# 拉 tag 上的文件
cnb-rs --repo wwvo/cnb-rs/cnb-rs repo file raw v0.12.1 Cargo.toml
# 限大小
cnb-rs --repo wwvo/cnb-rs/cnb-rs repo file raw main large.txt --max-bytes 1000000API
GET ${CNB_API_ENDPOINT}/{repo}/-/git/raw/{ref}/{path}
CNB API 把 ref + path 拼成单一 URL 路径段;本命令在 CLI 层暴露独立两参,内部
format!("{}/{}")拼接。