diff --git a/CHANGELOG.md b/CHANGELOG.md index da42dbf..975a0e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,8 @@ -## [1.0.0] - TBA +## [1.0.0] - 2021-12-27 ### Added - Can now clone a package from a git repository specified in package's Cargo.toml file using `--git`. - Test coverage was improved significantly. -### Removed -- Removed option to download multiple crates to simplify the CLI. -- Removed option to clone from git repo directly. This was deemed out-of-scope. -- Removed dependency on Serde. -- Removed `--path` as it is unneeded. - ### Changed - clap.rs is used instead of Docopt. - `--prefix` is now a positional argument named `directory`. @@ -17,6 +11,10 @@ - `--vers` is removed in favor of inline version specs: `cargo-clone@1.0.0`. - Several other minimal CLI changes. +### Removed +- Removed option to clone from git repo directly. This was deemed out-of-scope. +- Removed dependency on Serde. +- Removed `--path` as it is unneeded. ## [0.2.0] - 2021-12-25 - Fix clone_directory. diff --git a/Cargo.lock b/Cargo.lock index a210964..e8d3fe3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -148,7 +148,7 @@ dependencies = [ [[package]] name = "cargo-clone" -version = "0.2.0" +version = "1.0.0" dependencies = [ "anyhow", "cargo", @@ -1062,9 +1062,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" -version = "1.0.83" +version = "1.0.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23a1dfb999630e338648c83e91c59a4e9fb7620f520c3194b6b89e276f2f1959" +checksum = "ecb2e6da8ee5eb9a61068762a32fa9619cc591ceb055b3687f4cd4051ec2e06b" dependencies = [ "proc-macro2", "quote", @@ -1158,9 +1158,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec" +checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" [[package]] name = "unicode-bidi" diff --git a/Cargo.toml b/Cargo.toml index 955a2d8..eb49b58 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ license = "Apache-2.0/MIT" name = "cargo-clone" readme = "README.md" repository = "https://github.com/JanLikar/cargo-clone" -version = "0.2.0" +version = "1.0.0" edition = "2021" [dependencies] diff --git a/README.md b/README.md index 460fd3d..4fd88fb 100644 --- a/README.md +++ b/README.md @@ -1,42 +1,64 @@ - _ - ___ __ _ _ __ __ _ ___ ___| | ___ _ __ ___ - / __/ _` | '__/ _` |/ _ \ _____ / __| |/ _ \| '_ \ / _ \ - | (_| (_| | | | (_| | (_) |_____| (__| | (_) | | | | __/ - \___\__,_|_| \__, |\___/ \___|_|\___/|_| |_|\___| - |___/ - -cargo-clone can be used to fetch the source code of a Rust crate. +# cargo-clone +cargo-clone can be used to fetch the source code of a Rust crate from a registry. cargo clone [FLAGS] [OPTIONS] ... [-- ] cargo-clone is a [Cargo subcommand](https://github.com/rust-lang/cargo/wiki/Third-party-cargo-subcommands). -It can be installed using the install subcommand +# Installation & upgrading cargo install cargo-clone -and can be used like this: +## Usage + + cargo clone [FLAGS] [OPTIONS] ... [-- ] + +To download cargo-clone's code you would use - cargo clone [options] [] + cargo clone cargo-clone + + +### Specifying versions +The latest available version is downloaded by default. +If specific versions are desired, semver specifiers can be appended to crate names. -For example, to download version 1.0.0 of cargo-clone's source from crates.io, you would run cargo clone cargo-clone@1.0.0 -Downloading multiple packages is also supported: +Versions are matched exactly by default, but other kinds of matching are also allowed. - cargo clone cargo-clone@1.0.0 serde time + cargo clone cargo-clone@~1.0.0 -The output dir can be specified as the last argument: - cargo clone serde time -- packages/ +### Cloning from git repositories +Using the `--git` flag runs `git clone` on each git repository url extracted from crate's metadata. -To checkout a git repo specified in the package's Cargo.toml, you can use the `--git` flag: +These lines are roughly equivalent: cargo clone --git cargo-clone + git clone https://github.com/janlikar/cargo-clone + +The command fails if a crate does not have the repository field set to a valid git repository. + + +### Output directory +Crates are downloaded into `$PWD/$CRATE_NAME` by default. + +The output dir can be specified as the last argument: + + cargo clone cargo-clone -- foo # Downloads into $PWD/foo + +If multiple packages are downloaded at the same time or if the directory contains a trailing slash, +the packages will be downloaded into subdirectories of the path provided. + + cargo clone cargo-clone -- pkgs/ # Creates pkgs/cargo-clone/ + cargo clone cargo serde -- pkgs2/ # Creates pkgs/cargo and pkgs/serde ## Contributing +Contributions are welcome. Feel free to open a PR into develop branch. When running locally, you can run using `cargo run -- clone CRATE` or `cargo-clone clone CRATE`. + +By opening a PR you agree to license your code under Apache/MIT licenses. diff --git a/src/main.rs b/src/main.rs index c5df9b2..d8f9b8d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -28,7 +28,7 @@ fn main() { Arg::with_name("color") .long("color") .value_name("COLORING") - .help("Coloring: auto, always, never") + .help("Coloring: auto, always, never.") .takes_value(true), ) .arg(