MCPcopy Index your code
hub / github.com/JanLikar/cargo-clone

github.com/JanLikar/cargo-clone @v1.2.4

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.2.4 ↗ · + Follow
52 symbols 107 edges 7 files 18 documented · 35%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

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.

Installation & upgrading

cargo install cargo-clone

Usage

cargo clone [FLAGS] [OPTIONS] <crate>... [-- <directory>]

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.

Core symbols most depended-on inside this repo

with_directory
called by 5
cargo-clone-core/src/cloner_builder.rs
build
called by 5
cargo-clone-core/src/cloner_builder.rs
clone
called by 4
cargo-clone-core/src/lib.rs
cargo_context
called by 2
cargo-clone/src/main.rs
clone_in_dir
called by 2
cargo-clone-core/src/lib.rs
clone_in
called by 2
cargo-clone-core/src/lib.rs
get_source
called by 2
cargo-clone-core/src/lib.rs
clone_directory
called by 2
cargo-clone-core/src/lib.rs

Shape

Function 25
Method 19
Class 5
Enum 3

Languages

Rust100%

Modules by API surface

cargo-clone-core/src/lib.rs19 symbols
cargo-clone-core/src/source.rs8 symbols
cargo-clone-core/src/cloner_builder.rs7 symbols
cargo-clone/tests/test_cli.rs6 symbols
cargo-clone/src/main.rs4 symbols
cargo-clone/src/args.rs4 symbols
cargo-clone-core/tests/test_clone.rs4 symbols

For agents

$ claude mcp add cargo-clone \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact