1CARGO-PKGID(1) CARGO-PKGID(1)
2
3
4
6 cargo-pkgid - Print a fully qualified package specification
7
9 cargo pkgid [OPTIONS] [SPEC]
10
12 Given a SPEC argument, print out the fully qualified package ID
13 specifier for a package or dependency in the current workspace. This
14 command will generate an error if SPEC is ambiguous as to which package
15 it refers to in the dependency graph. If no SPEC is given, then the
16 specifier for the local package is printed.
17
18 This command requires that a lockfile is available and dependencies
19 have been fetched.
20
21 A package specifier consists of a name, version, and source URL. You
22 are allowed to use partial specifiers to succinctly match a specific
23 package as long as it matches only one package. The format of a SPEC
24 can be one of the following:
25
26 Table 1. SPEC Query Format
27 ┌─────────────────┬───────────────────────────────────────────────────────┐
28 │ │ │
29 │SPEC Structure │ Example SPEC │
30 ├─────────────────┼───────────────────────────────────────────────────────┤
31 │ │ │
32 │NAME │ bitflags │
33 ├─────────────────┼───────────────────────────────────────────────────────┤
34 │ │ │
35 │NAME:VERSION │ bitflags:1.0.4 │
36 ├─────────────────┼───────────────────────────────────────────────────────┤
37 │ │ │
38 │URL │ https://github.com/rust-lang/cargo │
39 ├─────────────────┼───────────────────────────────────────────────────────┤
40 │ │ │
41 │URL#VERSION │ https://github.com/rust-lang/cargo#0.33.0 │
42 ├─────────────────┼───────────────────────────────────────────────────────┤
43 │ │ │
44 │URL#NAME │ https://github.com/rust-lang/crates.io-index#bitflags │
45 ├─────────────────┼───────────────────────────────────────────────────────┤
46 │ │ │
47 │URL#NAME:VERSION │ https://github.com/rust-lang/cargo#crates-io:0.21.0 │
48 └─────────────────┴───────────────────────────────────────────────────────┘
49
51 Package Selection
52 -p SPEC, --package SPEC
53 Get the package ID for the given package instead of the current
54 package.
55
56 Display Options
57 -v, --verbose
58 Use verbose output. May be specified twice for "very verbose"
59 output which includes extra output such as dependency warnings and
60 build script output. May also be specified with the term.verbose
61 config value
62 <https://doc.rust-lang.org/cargo/reference/config.html>.
63
64 -q, --quiet
65 No output printed to stdout.
66
67 --color WHEN
68 Control when colored output is used. Valid values:
69
70 · auto (default): Automatically detect if color support is
71 available on the terminal.
72
73 · always: Always display colors.
74
75 · never: Never display colors.
76
77 May also be specified with the term.color config value
78 <https://doc.rust-lang.org/cargo/reference/config.html>.
79
80 Manifest Options
81 --manifest-path PATH
82 Path to the Cargo.toml file. By default, Cargo searches in the
83 current directory or any parent directory for the Cargo.toml file.
84
85 --frozen, --locked
86 Either of these flags requires that the Cargo.lock file is
87 up-to-date. If the lock file is missing, or it needs to be updated,
88 Cargo will exit with an error. The --frozen flag also prevents
89 Cargo from attempting to access the network to determine if it is
90 out-of-date.
91
92 These may be used in environments where you want to assert that the
93 Cargo.lock file is up-to-date (such as a CI build) or want to avoid
94 network access.
95
96 Common Options
97 -h, --help
98 Prints help information.
99
100 -Z FLAG...
101 Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
102 details.
103
105 See the reference
106 <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
107 for details on environment variables that Cargo reads.
108
110 0
111 Cargo succeeded.
112
113 101
114 Cargo failed to complete.
115
117 1. Retrieve package specification for foo package:
118
119 cargo pkgid foo
120
121 2. Retrieve package specification for version 1.0.0 of foo:
122
123 cargo pkgid foo:1.0.0
124
125 3. Retrieve package specification for foo from crates.io:
126
127 cargo pkgid https://github.com/rust-lang/crates.io-index#foo
128
130 cargo(1), cargo-generate-lockfile(1), cargo-metadata(1)
131
132
133
134 2018-12-20 CARGO-PKGID(1)