An experimental Cargo subcommand to access and manipulate a registry index.
See reg-index for the corresponding library that implements this command's functionality.
cargo install cargo-index
This requires at a minimum Cargo 1.70.
The cargo index command provides several sub-commands:
| Subcommand | Description |
|---|---|
| add | Add a package to an index. |
| init | Create a new index. |
| list | List entries in the index. |
| metadata | Generate JSON metadata for a package. |
| unyank | Un-yank a crate from an index. |
| validate | Validate the format of an index. |
| yank | Yank a crate from an index. |
Run the sub-command with --help to get more information.
Example of creating an index and manually adding a new package:
-
cargo index init --dl https://example.com --index indexThis creates a new git repository in the directory
indexwith the appropriateconfig.jsonfile. -
cargo new fooCreate a sample project to add.
-
cd foo -
cargo index add --index ../index --index-url https://example.com -- --allow-dirtyAdds the
foopackage to the index. -
cargo index list --index ../index -p fooShows the JSON metadata for every version of
fooin the index.