https://github.com/janlikar/cargo-clone
A cargo subcommand to fetch the source code of a Rust crate
https://github.com/janlikar/cargo-clone
cargo cargo-subcommand rust-crate
Last synced: 3 months ago
JSON representation
A cargo subcommand to fetch the source code of a Rust crate
- Host: GitHub
- URL: https://github.com/janlikar/cargo-clone
- Owner: JanLikar
- License: apache-2.0
- Created: 2016-01-12T14:48:49.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2025-10-20T06:12:44.000Z (3 months ago)
- Last Synced: 2025-10-21T03:56:37.416Z (3 months ago)
- Topics: cargo, cargo-subcommand, rust-crate
- Language: Rust
- Size: 500 KB
- Stars: 109
- Watchers: 3
- Forks: 16
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# 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).
# Installation & upgrading
cargo install cargo-clone
## Usage
cargo clone [FLAGS] [OPTIONS] ... [-- ]
To download cargo-clone's code you would use
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.
cargo clone cargo-clone@1.0.0
Versions are matched exactly by default, but other kinds of matching are also allowed.
cargo clone cargo-clone@~1.0.0
### Cloning from git repositories
Using the `--git` flag runs `git clone` on each git repository url extracted from crate's metadata.
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 pkgs2/cargo and pkgs2/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.