From caaa2a58bd3c53a094e931f027b9cd81643cd653 Mon Sep 17 00:00:00 2001 From: Patrick D'appollonio <930925+patrickdappollonio@users.noreply.github.com> Date: Wed, 15 Jan 2025 23:09:51 -0500 Subject: [PATCH] Update Readme. Bump Rust crate versions. --- Cargo.lock | 22 +++++++++++----------- Cargo.toml | 2 +- README.md | 44 +++++++++++++++++++++++++++++++------------- 3 files changed, 43 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0ea9dad..2c22e08 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "aho-corasick" @@ -31,9 +31,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.155" +version = "0.2.169" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" [[package]] name = "memchr" @@ -43,9 +43,9 @@ checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "regex" -version = "1.10.6" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", @@ -55,9 +55,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", @@ -66,9 +66,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "subprocess" @@ -82,9 +82,9 @@ dependencies = [ [[package]] name = "unicode-width" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" [[package]] name = "winapi" diff --git a/Cargo.toml b/Cargo.toml index 21d4903..f95131e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [dependencies] getopts = "0.2.21" -regex = "1.10.6" +regex = "1.11" subprocess = "0.2.9" [profile.release] diff --git a/README.md b/README.md index d97e322..bf59d58 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,52 @@ # `gc-rust` a GitHub clone helper +- [`gc-rust` a GitHub clone helper](#gc-rust-a-github-clone-helper) + - [Installation](#installation) + - [Usage](#usage) + - [Defining a location for the repositories](#defining-a-location-for-the-repositories) + - [Specifying a branch](#specifying-a-branch) + `gc-rust` is a tiny Rust application that allows you to clone GitHub repositories with ease to a predetermined location. -As an original Go developer, I liked the idea that my code was organized in the form of: +As a Go developer, I liked the idea that my code was organized using a `$GOPATH`, in the form of: -``` -~/go/src/github.com// +```bash +$HOME/go/src/github.com// ``` So I kept maintaining even non-Go projects in the same way. -This is where `gc-rust` comes in handy. Given a GitHub repository URL, it will perform the `git clone` operation by finding the appropriate location for the resulting folder. +This is where `gc-rust` comes in handy: Given a GitHub repository URL, it will perform the `git clone` operation by finding the appropriate location for the resulting folder. For example, given the repository: -``` +```bash github.com/example/application ``` It will correctly create the folder structure so the repository is cloned to: -``` -~/go/src/github.com/example/application +```bash +$HOME/go/src/github.com/example/application ``` -If there was a preexistent folder, it will ask you if you want to overwrite it. **This will destroy any prior content in the destination folder!** +You can configure the location where the repositories are cloned by setting the `$GC_DOWNLOAD_PATH` environment variable. [Instructions below](#defining-a-location-for-the-repositories). + +If there was a preexistent folder in the location where the clone should happen, it will ask you if you want to overwrite it. **This will destroy any prior content in the destination folder!** + +### Installation + +Download a copy of the binary and place it anywhere in your `$PATH`. Downloads are available in the [releases page](https://www.github.com/patrickdappollonio/gc-rust/releases/latest). + +If you have Homebrew installed on macOS or Linux, you can also install it via: + +```bash +brew install patrickdappollonio/tap/gc-rust +``` ### Usage -To clone the repository, you can run any of the following: +To clone a GitHub repository, you can use any of the following instructions: ```bash gc-rust git@github.com:example/application.git @@ -40,7 +58,7 @@ gc-rust https://github.com/example/application/security/dependabot gc-rust https://github.com/example/application/this/is/a/made/up/path ``` -All of them will detect the repository being `github.com/example/application` and clone it to the correct location. +All of them will detect the repository as `github.com/example/application` and clone it to the correct location. The output of `gc-rust` will all be printed to `stderr` with one exception: the folder location where it was cloned. This is useful if you want to create a function that both clones a repository and then `cd` into it: @@ -55,7 +73,7 @@ function gc() { } ``` -With this in your `bashrc` or `bash_profile`, you can now simply run `gc` and it will clone the repository and `cd` into it: +With this in your `.bashrc` or `.bash_profile`, you can now simply run `gc` and it will clone the repository and `cd` into it: ```bash $ pwd @@ -78,11 +96,11 @@ $ pwd ### Defining a location for the repositories -By default, `gc-rust` will clone the repositories to the path defined in the environment variable `$GC_DOWNLOAD_PATH`. If this variable is not set, it will use the `$GOPATH` environment variable since the original idea came from Go project management. If neither are defined you'll see an error. +By default, **`gc-rust` will clone the repositories to the path defined in the environment variable `$GC_DOWNLOAD_PATH`**. If this variable is not set, it will use the `$GOPATH` environment variable since the original idea came from Go project management. If neither are defined you'll see an error. ### Specifying a branch -Contrary to what you might think, `gc-rust` will not deduce a branch name from the URL. Instead, it will clone using whatever branch is currently set as the default in the repository. If you want to clone a specific branch, you can do so by specifying the `-b` or `--branch` flag: +Contrary to what you might think, **`gc-rust` will not deduce a branch name from the URL**. Instead, it will clone using whatever branch is currently set as the default in the repository. If you want to clone a specific branch, you can do so by specifying the `-b` or `--branch` flag: ```bash # this will clone `patrickdappollonio/http-server` into the `feature-branch` branch,