#clone #git-tool #git #directory #tool #command-line-tool

app clone-github-subdir

将 GitHub 仓库的任何子目录克隆到您的本地机器

2 个版本

0.1.1 2023 年 7 月 30 日
0.1.0 2023 年 7 月 30 日

#2966命令行工具

MIT 许可证

13KB
199

clone-github-subdir

使用这个便捷的命令行工具,可以将 GitHub 仓库的任何子目录克隆到您的本地机器。如果您只想克隆仓库的特定部分,这将非常有用。

安装

您可以使用 cargo 从 crates.io 安装 clone-github-subdir

cargo install clone-github-subdir

或者您可以使用 git 从源代码构建它

git clone https://github.com/isurfer21/clone-github-subdir.git
cd clone-github-subdir
cargo build --release

用法

要使用 clone-github-subdir,首先使用短命令 cgs 并带 --help-h 选项检查所有设置,例如:

> cgs --help
Usage:
 cgs [options] <link>

Arguments:
 link              Github sub-directory URL

Options:
 -h, --help         Show this help message
 -v, --version      Show the program version
 -c, --curdir       Current sub-directory only

您还可以使用以下选项

  • -h, --help: 显示帮助信息并退出。
  • -v, --version: 显示程序版本并退出。
  • -c, --curdir: 只克隆当前子目录,而不是其父目录。

现在要克隆 GitHub 子目录,您可以将任何 GitHub 仓库的子目录 URL 作为参数提供,例如:

cgs https://github.com/second-state/wasm-learning/tree/master/nodejs/hello

这将把 nodejs/hello 子目录克隆到 second-state/wasm-learning 仓库的当前工作目录。

或者,要只克隆目标子目录,您可以使用 --curdir-c 选项,例如:

cgs -c https://github.com/second-state/wasm-learning/tree/master/nodejs/hello

这将只克隆 hello 子目录,而不是像 nodejs/hello 那样克隆其父目录。

许可证

本项目采用 MIT 许可证。有关更多详细信息,请参阅 LICENSE 文件。

依赖关系

~5–21MB
~285K SLoC