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 --offline
97 Prevents Cargo from accessing the network for any reason. Without
98 this flag, Cargo will stop with an error if it needs to access the
99 network and the network is not available. With this flag, Cargo
100 will attempt to proceed without the network if possible.
101
102 Beware that this may result in different dependency resolution than
103 online mode. Cargo will restrict itself to crates that are
104 downloaded locally, even if there might be a newer version as
105 indicated in the local copy of the index. See the cargo-fetch(1)
106 command to download dependencies before going offline.
107
108 May also be specified with the net.offline config value
109 <https://doc.rust-lang.org/cargo/reference/config.html>.
110
111 Common Options
112 -h, --help
113 Prints help information.
114
115 -Z FLAG...
116 Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
117 details.
118
120 See the reference
121 <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
122 for details on environment variables that Cargo reads.
123
125 0
126 Cargo succeeded.
127
128 101
129 Cargo failed to complete.
130
132 1. Retrieve package specification for foo package:
133
134 cargo pkgid foo
135
136 2. Retrieve package specification for version 1.0.0 of foo:
137
138 cargo pkgid foo:1.0.0
139
140 3. Retrieve package specification for foo from crates.io:
141
142 cargo pkgid https://github.com/rust-lang/crates.io-index#foo
143
145 cargo(1), cargo-generate-lockfile(1), cargo-metadata(1)
146
147
148
149 2019-06-07 CARGO-PKGID(1)