Skip to content

Commit

Permalink
Prepare for 1.0.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
JanLikar committed Dec 26, 2021
1 parent 301cb7b commit aa18f50
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 31 deletions.
12 changes: 5 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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`.
Expand All @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
56 changes: 39 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -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] <crate>... [-- <directory>]

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] <crate>... [-- <directory>]

To download cargo-clone's code you would use

cargo clone [options] [<crate>]
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.
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit aa18f50

Please sign in to comment.