cargo-info
Display Rust crate information
TLDR
Display information about a package on
Display information about a specific version of a package
Display additional information about a package
SYNOPSIS
cargo info [OPTIONS] [PACKAGE_ID]
cargo-info [OPTIONS] [PACKAGE_ID]
PARAMETERS
PACKAGE_ID
The name of the package (e.g., `serde`) or a package name with a version requirement (e.g., `serde@1.0.0` or `serde@^1.0`). If omitted, it queries the current project's Cargo.toml.
-h, --help
Prints help information to the console.
-V, --version
Prints version information for cargo-info.
-o, --output OUTPUT
Specifies the output format. Supported values are `text` (default) and `json`.
-R, --registry REGISTRY
Specifies an alternative registry to use instead of the default crates.io.
-a, --all-versions
Displays information for all available versions of the specified package.
-s, --sort-by SORT_BY
Sorts dependencies by the specified criterion when displaying multiple versions. Options include `name`, `version`, `downloads`.
-i, --indent INDENT
Specifies the number of spaces to indent the JSON output when `--output json` is used.
-D, --description
Shows the package description.
-H, --homepage
Shows the package's homepage URL.
-r, --repository
Shows the package's source code repository URL.
-d, --documentation
Shows the package's documentation URL.
-l, --license
Shows the package's license type.
-u, --users
Shows crates that depend on this package.
-c, --crates-io
Shows the package's URL on crates.io.
-k, --keywords
Shows the package's associated keywords.
-e, --categories
Shows the package's assigned categories.
-K, --yanked
Shows the yanked status of a package version (if it has been withdrawn).
-S, --size
Shows the size of the package's archive.
-B, --authors
Shows the authors of the package.
-C, --changelog
Shows the package's changelog URL.
-t, --audit
Performs a security audit on the package. Requires cargo-audit to be installed separately.
-p, --no-deps
Suppresses the display of package dependencies.
-v, --verbose
Uses verbose output, providing more detailed information.
-q, --quiet
Suppresses informational messages, only printing direct output. Useful with `--output json`.
--locked
Requires Cargo.lock to be up to date if querying the current project's dependencies.
--frozen
Requires Cargo.lock and all sources to be up to date. Prevents network access if possible.
--offline
Runs without accessing the network, relying solely on locally cached data.
DESCRIPTION
cargo-info is a powerful subcommand for the Rust package manager, cargo, designed to retrieve and display extensive information about Rust packages (crates) available on crates.io. It allows developers to quickly query details for a specific crate by its name and optional version, or to inspect the dependencies of the current project if no package ID is provided.
The command offers a wide array of data points including the crate's description, homepage, repository, documentation links, license, keywords, categories, authors, download statistics, and even security audit information (with an additional tool). Its flexibility extends to output formats, supporting both human-readable text (default) and machine-readable JSON, making it an invaluable tool for both interactive exploration and scripting automated dependency analysis. It provides essential insights into the ecosystem for any Rust developer.
CAVEATS
- cargo-info is not a standard Linux utility; it's a cargo subcommand specific to the Rust ecosystem.
- It must be installed separately via `cargo install cargo-info`.
- The `--audit` option requires the `cargo-audit` tool to be installed for full functionality.
- Most information retrieval depends on network access to crates.io unless `--offline` is used with pre-cached data.
INSTALLATION
Unlike core cargo commands, cargo-info is a third-party subcommand and is not bundled by default with the Rust toolchain. Users must explicitly install it using the cargo's `install` command: cargo install cargo-info
This makes it available as `cargo info`.
NETWORK DEPENDENCY
A significant portion of cargo-info's functionality relies on fetching data directly from crates.io, the official Rust package registry. This means that an active internet connection is generally required for the command to operate correctly and retrieve the latest package information. The `--offline` flag can be used to prevent network access, but it will only provide information that has been previously cached locally by cargo.
HISTORY
cargo-info emerged as a community-driven solution to address a gap in cargo's core functionality, which lacked a dedicated command for easily retrieving detailed metadata about crates from crates.io. It was developed to provide Rust developers with quick, on-demand access to critical package information directly from their terminal. Over time, it has evolved, adding more granular options for displaying specific data points and supporting different output formats, adapting to the growing needs of the Rust community for better dependency introspection and management.


