13个版本 (4个重大变更)
新 0.5.3 | 2024年8月5日 |
---|---|
0.5.2 | 2024年7月30日 |
0.4.0 | 2024年7月23日 |
0.3.4 | 2024年7月21日 |
0.1.1 | 2024年7月13日 |
#288 in 开发工具
每月1,358次下载
31KB
492 行
创建Rust GitHub仓库
概述
create-rust-github-repo
是一个命令行程序,用于在GitHub上创建新仓库,本地克隆它,初始化Rust项目,并从现有目录复制配置。
示例
# Create a GitHub repo & init a Rust project
create-rust-github-repo --name my-new-project
# Copy configs from existing project
create-rust-github-repo --name my-new-project --copy-configs-from ~/workspace/my-existing-project --configs .github,rustfmt.toml,clippy.toml
# Clone to a specific directory
create-rust-github-repo --name my-new-project --dir ~/workspace/my-new-project
# Create a public repo
create-rust-github-repo --name my-new-project --repo-create-cmd "gh repo create --public {{name}}"
# Create a lib instead of bin
create-rust-github-repo --name my-new-project --project-init-cmd "cargo init --lib"
功能
- ✅ 使用现有的
gh
、git
、cargo
命令 - ✅ 支持所有命令的重写
- ✅ 支持替换(请参阅以下帮助文档)
- ✅ 可用作库
安装
cargo install create-rust-github-repo
用法
`create-rust-github-repo` is a CLI program that creates a new repository on GitHub, clones it locally, initializes a Rust project, copies the configs from a pre-existing directory.
Usage: create-rust-github-repo [OPTIONS] --name <NAME>
Options:
-n, --name <NAME>
Repository name
-d, --dir <DIR>
Target directory for cloning the repository (must include the repo name) (defaults to "{current_dir}/{repo_name}") (see also: --workspace)
-w, --workspace <WORKSPACE>
Parent of the target directory for cloning the repository (must NOT include the repo name). If this option is specified, then the repo is cloned to "{workspace}/{repo_name}". The --dir option overrides this option
--shell-cmd <SHELL_CMD>
Shell to use for executing commands
[default: /bin/sh]
--shell-args <SHELL_ARGS>
Shell args to use for executing commands (note that '-c' is always passed as last arg)
-c, --copy-configs-from <COPY_CONFIGS_FROM>
Source directory for config paths
--configs <CONFIGS>
Config paths separated by comma (relative to `copy_configs_from`) (only applies if `copy_configs_from` is specified) (supports files and directories)
--repo-exists-cmd <REPO_EXISTS_CMD>
Shell command to check if repo exists (supports substitutions - see help below)
[default: "gh repo view --json nameWithOwner {{name}} 2>/dev/null"]
--repo-create-cmd <REPO_CREATE_CMD>
Shell command to create a repo (supports substitutions - see help below)
[default: "gh repo create --private {{name}}"]
--repo-clone-cmd <REPO_CLONE_CMD>
Shell command to clone a repo (supports substitutions - see help below)
[default: "gh repo clone {{name}} {{dir}}"]
--project-init-cmd <PROJECT_INIT_CMD>
Shell command to initialize a project (supports substitutions - see help below)
[default: "cargo init"]
--project-test-cmd <PROJECT_TEST_CMD>
Shell command to test a project (supports substitutions - see help below)
[default: "cargo test"]
--repo-add-args <REPO_ADD_ARGS>
Shell command to add new files (supports substitutions - see help below)
[default: "git add ."]
--repo-commit-args <REPO_COMMIT_ARGS>
Shell command to make a commit (supports substitutions - see help below)
[default: "git commit -m \"feat: setup project\""]
--repo-push-args <REPO_PUSH_ARGS>
Shell command to push the commit (supports substitutions - see help below)
[default: "git push"]
-s, --support-link-probability <SUPPORT_LINK_PROBABILITY>
The probability of seeing a support link in a single execution of the command is `1 / {{this-field-value}}`.
Set it to 0 to disable the support link.
[env: SUPPORT_LINK_PROBABILITY=]
[default: 1]
--dry-run
Don't actually execute commands that modify the data, only print them (note that read-only commands will still be executed)
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
All command arg options support the following substitutions:
* {{name}} - substituted with --name arg
* {{dir}} - substituted with resolved directory for repo (the resolved value of --dir)
附加二进制文件
create-rust-github-private-bin
create-rust-github-private-lib
create-rust-github-public-bin
create-rust-github-public-lib
create-rust-keybase-private-bin
感谢
喜欢这个项目? ⭐ 在GitHub上星标此仓库!
许可证
Apache许可证2.0 或 MIT许可证,任选其一。
除非你明确表示,否则你提交到该包的任何贡献,根据Apache-2.0许可证定义,都应按上述方式双许可,不附加任何额外条款或条件。
依赖项
~1.7–2.3MB
~44K SLoC