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 仓库 | 本地开发 |
子命令
- cnb-rs repo file list — 列目录 / 看文件 meta(alias
ls) - cnb-rs repo file raw — 拉文件原始内容(输出 stdout)
- cnb-rs repo file head — 查默认分支 HEAD
示例
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另请参阅
- cnb-rs repo
- cnb-rs repo branch
- cnb-rs download — archive / lfs-link