Skip to content

All-in-one tool for creating a new project. It creates a new repository, clones it locally, initializes the project, copies the configs from a pre-existing directory.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

DenisGorbachev/create-rust-github-repo

Repository files navigation

Create Rust GitHub repo

Build Documentation

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

# 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

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 <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)

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 on GitHub!

License

Apache License 2.0 or MIT License 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.

About

All-in-one tool for creating a new project. It creates a new repository, clones it locally, initializes the project, copies the configs from a pre-existing directory.

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published