CARGO-PKGID(1)
๐ CARGO-PKGID ๐
okay so bestie, welcome to cargo-pkgid โ it's a page straight out of the General Commands Manual and it's about to tell you literally everything you need to know about printing a fully qualified package spec. grab a boba, we're doing this โจ
๐ธ NAME ๐ธ
cargo-pkgid โ Print a fully qualified package specification
๐ฆ SYNOPSIS ๐ฆ
cargo pkgid [options] [spec]
โจ DESCRIPTION โจ
So here's the vibe ๐ซถ if you hand it a spec argument, it prints out the fully qualified package ID specifier for a package or dependency in the current workspace. Like, the whole entire glow-up name, not the nickname.
Heads up bestie: if spec is ambiguous about which package it means in the dependency graph, this command will generate an error. no cap. it does not guess. ๐
If you don't give it a spec at all, then it just prints the specifier for the local package. easy.
This command requires that a lockfile is available and dependencies have been fetched. it's giving "do your homework first" energy ๐ญ
A package specifier is made of a name, a version, and a source URL. You're allowed to use partial specifiers to succinctly match a specific package โ as long as it matches only one package. slay. This specifier is also used by other parts in Cargo, such as cargo-metadata(1) and JSON messages emitted by Cargo โ that's at https://doc.rust-lang.org/cargo/reference/external-tools.html#json-messages btw ๐
The format of a spec can be one of the following:
nameโ example:bitflagsname@versionโ example:bitflags@1.0.4urlโ example:https://github.com/rust-lang/cargourl#versionโ example:https://github.com/rust-lang/cargo#0.33.0url#nameโ example:https://github.com/rust-lang/crates.io-index#bitflagsurl#name@versionโ example:https://github.com/rust-lang/cargo#crates-io@0.21.0
The specification grammar lives in chapter Package ID Specifications at https://doc.rust-lang.org/cargo/reference/pkgid-spec.html. iykyk ๐
๐ OPTIONS ๐
๐ฆ Package Selection ๐ฆ
-pspec,--packagespec โ Get the package ID for the given package instead of the current package. periodt.
๐ Display Options ๐
-v,--verboseโ Use verbose output. May be specified twice for "very verbose" output, which includes extra output such as dependency warnings and build script output. May also be specified with theterm.verboseconfig value athttps://doc.rust-lang.org/cargo/reference/config.html.-q,--quietโ Do not print cargo log messages. May also be specified with theterm.quietconfig value athttps://doc.rust-lang.org/cargo/reference/config.html. shhh ๐คซ--colorwhen โ Control when colored output is used. Valid values:auto(default): Automatically detect if color support is available on the terminal.always: Always display colors.never: Never display colors.
May also be specified with the term.color config value at https://doc.rust-lang.org/cargo/reference/config.html. aesthetic choices are valid โจ
๐ง Manifest Options ๐ง
--manifest-pathpath โ Path to theCargo.tomlfile. By default, Cargo searches for theCargo.tomlfile in the current directory or any parent directory. it goes looking, bestie ๐--lockedโ Asserts that the exact same dependencies and versions are used as when the existingCargo.lockfile was originally generated. Cargo will exit with an error when either of the following scenarios arises:- The lock file is missing.
- Cargo attempted to change the lock file due to a different dependency resolution.
It may be used in environments where deterministic builds are desired, such as in CI pipelines. main character energy for reproducibility ๐
--offlineโ Prevents Cargo from accessing the network for any reason. Without this flag, Cargo will stop with an error if it needs to access the network and the network is not available. With this flag, Cargo will attempt to proceed without the network if possible.
โ ๏ธ Beware that this may result in different dependency resolution than online mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index. See the cargo-fetch(1) command to download dependencies before going offline.
May also be specified with the net.offline config value at https://doc.rust-lang.org/cargo/reference/config.html. airplane mode but make it Rust โ๏ธ
--frozenโ Equivalent to specifying both--lockedand--offline. two for one deal, obsessed ๐
๐ Common Options ๐
+toolchainโ If Cargo has been installed with rustup, and the first argument to cargo begins with+, it will be interpreted as a rustup toolchain name (such as+stableor+nightly). See the rustup documentation athttps://rust-lang.github.io/rustup/overrides.htmlfor more information about how toolchain overrides work.--configKEY=VALUE or PATH โ Overrides a Cargo configuration value. The argument should be in TOML syntax ofKEY=VALUE, or provided as a path to an extra configuration file. This flag may be specified multiple times. See the command-line overrides section athttps://doc.rust-lang.org/cargo/reference/config.html#command-line-overridesfor more information.-CPATH โ Changes the current working directory before executing any specified operations. This affects things like where cargo looks by default for the project manifest (Cargo.toml), as well as the directories searched for discovering.cargo/config.toml, for example. This option must appear before the command name, for examplecargo -C path/to/my-project build.
This option is only available on the nightly channel athttps://doc.rust-lang.org/book/appendix-07-nightly-rust.htmland requires the-Z unstable-optionsflag to enable (see #10098 athttps://github.com/rust-lang/cargo/issues/10098). so like, unstable babe, handle with care ๐
-h,--helpโ Prints help information. when in doubt ๐ซถ-Zflag โ Unstable (nightly-only) flags to Cargo. Runcargo -Z helpfor details.
๐ ENVIRONMENT ๐
See the reference at https://doc.rust-lang.org/cargo/reference/environment-variables.html for details on environment variables that Cargo reads. that's the whole section, it's short and it knows it ๐
๐ EXIT STATUS ๐
0: Cargo succeeded. ๐101: Cargo failed to complete. ๐ญ
โญ EXAMPLES โญ
- Retrieve package specification for
foopackage:
cargo pkgid foo
- Retrieve package specification for version
1.0.0offoo:
cargo pkgid foo@1.0.0
- Retrieve package specification for
foofrom crates.io:
cargo pkgid https://github.com/rust-lang/crates.io-index#foo
- Retrieve package specification for
foofrom a local package:
cargo pkgid file:///path/to/local/package#foo
๐ฅ SEE ALSO ๐ฅ
cargo(1)cargo-generate-lockfile(1)cargo-metadata(1)- Package ID Specifications at
https://doc.rust-lang.org/cargo/reference/pkgid-spec.html - JSON messages at
https://doc.rust-lang.org/cargo/reference/external-tools.html#json-messages
and that's the whole thing bestie, no crumbs left ๐ this was the CARGO-PKGID(1) page from the General Commands Manual โ go forth and print those fully qualified package specs, you absolute icon ๐๐
๐ฆ where this page comes from
- alpine 3.24: cargo-doc 1.96.1-r0 ยท Apache-2.0 OR MIT
- alpine 3.24: chromium-cargo-doc 1.97.0-r0 ยท Apache-2.0 OR MIT
- centos-stream 10: cargo 1.99.1-1.el10 ยท (Apache-2.0 OR MIT) AND (Artistic-2.0 AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 AND Unicode-3.0)
- centos-stream 9: cargo 1.99.1-1.el9 ยท (Apache-2.0 OR MIT) AND (Artistic-2.0 AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 AND Unicode-3.0)
- debian bookworm: cargo-web 1.96.0+dfsg1-1~deb12u2 ยท MIT OR Apache-2.0
- debian trixie: cargo-web 1.96.0+dfsg1-1~deb13u1+b1 ยท MIT OR Apache-2.0
- fedora 43: cargo 1.98.1-1.fc43
- fedora 43: cargo 1.99.0-1.fc43
- fedora 43: cargo 1.99.1-2.fc43 ยท (Apache-2.0 OR MIT) AND (Artistic-2.0 AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 AND Unicode-3.0)
- fedora 44: cargo 1.94.1-1.fc44 ยท (Apache-2.0 OR MIT) AND (Artistic-2.0 AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 AND Unicode-3.0)
- fedora 44: cargo 1.98.1-1.fc44
- fedora 44: cargo 1.99.0-1.fc44
- fedora 44: cargo 1.99.1-2.fc44 ยท (Apache-2.0 OR MIT) AND (Artistic-2.0 AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 AND Unicode-3.0)
- nixos 26.05: cargo 1.95.0
- opensuse-leap 16.0: cargo1.94 1.94.1-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.94 1.94.1-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.94 1.94.1-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.94 1.94.1-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.95 1.95.0-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.95 1.95.0-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.95 1.95.0-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.95 1.95.0-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.96 1.96.1-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.96 1.96.1-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.96 1.96.1-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.96 1.96.1-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.97 1.97.0-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.97 1.97.0-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.97 1.97.0-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.97 1.97.0-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.98 1.98.0-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.98 1.98.0-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.98 1.98.0-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.98 1.98.0-160000.1.1 ยท Apache-2.0 OR MIT
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms