# Create Rust GitHub repo [![Build](https://github.com/DenisGorbachev/create-rust-github-repo/actions/workflows/ci.yml/badge.svg)](https://github.com/DenisGorbachev/create-rust-github-repo) [![Documentation](https://docs.rs/create-rust-github-repo/badge.svg)](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 --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" ``` ## Features * ✅ Uses existing `gh`, `git`, `cargo` commands * ✅ Supports overrides for all commands * ✅ Supports substitutions (see help below) * ✅ Can be used as a library ## Installation ```shell cargo install --locked 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 Options: -n, --name Repository name -d, --dir Target directory for cloning the repository (must include the repo name) (defaults to "{current_dir}/{repo_name}") (see also: --workspace) -w, --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 to use for executing commands [default: /bin/sh] --shell-args Shell args to use for executing commands (note that '-c' is always passed as last arg) -c, --copy-configs-from Source directory for config paths --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 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 Shell command to create a repo (supports substitutions - see help below) [default: "gh repo create --private {{name}}"] --repo-clone-cmd Shell command to clone a repo (supports substitutions - see help below) [default: "gh repo clone {{name}} {{dir}}"] --project-init-cmd Shell command to initialize a project (supports substitutions - see help below) [default: "cargo init"] --project-test-cmd Shell command to test a project (supports substitutions - see help below) [default: "cargo test"] --repo-add-args Shell command to add new files (supports substitutions - see help below) [default: "git add ."] --repo-commit-args Shell command to make a commit (supports substitutions - see help below) [default: "git commit -m \"feat: setup project\""] --repo-push-args Shell command to push the commit (supports substitutions - see help below) [default: "git push"] -s, --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) ``` ## 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` * `create-rust-keybase-private-lib` ## Gratitude Like the project? [⭐ Star this repo](https://github.com/DenisGorbachev/create-rust-github-repo) on GitHub! ## 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.