跳转到内容

cnb-rs repo file

cnb-rs repo file <subcommand>

仓库文件读取子组。覆盖 list 目录 / raw 拉文件 / head 查默认分支 3 个常用 git read 操作。

与 download / clone 的区别

命令拉取范围适合
repo file list <path>单个目录 / 文件 meta浏览仓库结构
repo file raw <ref> <path>单个文件原始内容脚本拿配置文件
repo download archive整仓 zip离线全量备份
repo clone完整 git 仓库本地开发

子命令

示例

bash
# 列仓库根目录
cnb-rs --repo wwvo/cnb-rs/cnb-rs repo file ls

# 列 src/ 目录
cnb-rs --repo wwvo/cnb-rs/cnb-rs repo file ls src

# 拉某个文件内容到 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 src/main.rs > /tmp/main.rs

# 查默认分支
cnb-rs --repo wwvo/cnb-rs/cnb-rs repo file head

另请参阅

Released under the MIT License.