# Create Rust GitHub repo
[](https://github.com/DenisGorbachev/create-rust-github-repo)
[](https://docs.rs/create-rust-github-repo)
## Overview
`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.
## Examples
```shell
# 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
# 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"
```
## Features
* [x] Uses existing `gh`, `git`, `cargo` commands
* [x] Supports overrides for all commands
* [x] Supports substitutions (see help below)
* [x] Can be used as a library
## Installation
```shell
cargo install create-rust-github-repo
```
## Usage
```
`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]
-c, --copy-configs-from <COPY_CONFIGS_FROM>
Source directory for configuration files
--extra-configs <EXTRA_CONFIGS>
Extra config file paths (relative to `source` directory)
--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 \"Add configs\""]
--repo-push-args <REPO_PUSH_ARGS>
Shell command to push the commit (supports substitutions - see help below) [default: "git push"]
-h, --help
Print help
-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)
```
## Additional binaries
* `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`
## Gratitude
Like the project? [Say thanks](https://github.com/DenisGorbachev/create-rust-github-repo)! ❤️
## License
[Apache License 2.0](LICENSE-APACHE) or [MIT License](LICENSE-MIT) at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.