fork/cargo

git clone https://git.julia.blue/fork/cargo

borsAuto merge of #14424 - Ifropc:lockfile-tracking-issue, r=weihanglo88957a1b7

0.93.0
8.8 KiB203 linesraw
1CARGO-PKGID(1)
2
3NAME
4       cargo-pkgid — Print a fully qualified package specification
5
6SYNOPSIS
7       cargo pkgid [options] [spec]
8
9DESCRIPTION
10       Given a spec argument, print out the fully qualified package ID
11       specifier for a package or dependency in the current workspace. This
12       command will generate an error if spec is ambiguous as to which package
13       it refers to in the dependency graph. If no spec is given, then the
14       specifier for the local package is printed.
15
16       This command requires that a lockfile is available and dependencies have
17       been fetched.
18
19       A package specifier consists of a name, version, and source URL. You are
20       allowed to use partial specifiers to succinctly match a specific package
21       as long as it matches only one package. This specifier is also used by
22       other parts in Cargo, such as cargo-metadata(1) and JSON messages
23       <https://doc.rust-lang.org/cargo/reference/external-tools.html#json-messages>
24       emitted by Cargo.
25
26       The format of a spec can be one of the following:
27
28       +-----------------+--------------------------------------------------+
29       | SPEC Structure  | Example SPEC                                     |
30       +-----------------+--------------------------------------------------+
31       | name            | bitflags                                         |
32       +-----------------+--------------------------------------------------+
33       | name@version    | bitflags@1.0.4                                   |
34       +-----------------+--------------------------------------------------+
35       | url             | https://github.com/rust-lang/cargo               |
36       +-----------------+--------------------------------------------------+
37       | url#version     | https://github.com/rust-lang/cargo#0.33.0        |
38       +-----------------+--------------------------------------------------+
39       | url#name        |                                                  |
40       |                 | https://github.com/rust-lang/crates.io-index#bitflags |
41       +-----------------+--------------------------------------------------+
42       |                 |                                                  |
43       | url#name@version | https://github.com/rust-lang/cargo#crates-io@0.21.0 |
44       +-----------------+--------------------------------------------------+
45
46       The specification grammar can be found in chapter Package ID
47       Specifications
48       <https://doc.rust-lang.org/cargo/reference/pkgid-spec.html>.
49
50OPTIONS
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           Do not print cargo log messages. May also be specified with the
66           term.quiet config value
67           <https://doc.rust-lang.org/cargo/reference/config.html>.
68
69       --color when
70           Control when colored output is used. Valid values:
71
72           o  auto (default): Automatically detect if color support is
73              available on the terminal.
74
75           o  always: Always display colors.
76
77           o  never: Never display colors.
78
79           May also be specified with the term.color config value
80           <https://doc.rust-lang.org/cargo/reference/config.html>.
81
82   Manifest Options
83       --manifest-path path
84           Path to the Cargo.toml file. By default, Cargo searches for the
85           Cargo.toml file in the current directory or any parent directory.
86
87       --locked
88           Asserts that the exact same dependencies and versions are used as
89           when the existing Cargo.lock file was originally generated. Cargo
90           will exit with an error when either of the following scenarios
91           arises:
92
93           o  The lock file is missing.
94
95           o  Cargo attempted to change the lock file due to a different
96              dependency resolution.
97
98           It may be used in environments where deterministic builds are
99           desired, such as in CI pipelines.
100
101       --offline
102           Prevents Cargo from accessing the network for any reason. Without
103           this flag, Cargo will stop with an error if it needs to access the
104           network and the network is not available. With this flag, Cargo will
105           attempt to proceed without the network if possible.
106
107           Beware that this may result in different dependency resolution than
108           online mode. Cargo will restrict itself to crates that are
109           downloaded locally, even if there might be a newer version as
110           indicated in the local copy of the index. See the cargo-fetch(1)
111           command to download dependencies before going offline.
112
113           May also be specified with the net.offline config value
114           <https://doc.rust-lang.org/cargo/reference/config.html>.
115
116       --frozen
117           Equivalent to specifying both --locked and --offline.
118
119       --lockfile-path PATH
120           Changes the path of the lockfile from the default
121           (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock
122           (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that
123           providing --lockfile-path will ignore existing lockfile at the
124           default path, and instead will either use the lockfile from PATH, or
125           write a new lockfile into the provided PATH if it doesn’t exist.
126           This flag can be used to run most commands in read-only directories,
127           writing lockfile into the provided PATH.
128
129           This option is only available on the nightly channel
130           <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
131           requires the -Z unstable-options flag to enable (see #14421
132           <https://github.com/rust-lang/cargo/issues/14421>).
133
134   Common Options
135       +toolchain
136           If Cargo has been installed with rustup, and the first argument to
137           cargo begins with +, it will be interpreted as a rustup toolchain
138           name (such as +stable or +nightly). See the rustup documentation
139           <https://rust-lang.github.io/rustup/overrides.html> for more
140           information about how toolchain overrides work.
141
142       --config KEY=VALUE or PATH
143           Overrides a Cargo configuration value. The argument should be in
144           TOML syntax of KEY=VALUE, or provided as a path to an extra
145           configuration file. This flag may be specified multiple times. See
146           the command-line overrides section
147           <https://doc.rust-lang.org/cargo/reference/config.html#command-line-overrides>
148           for more information.
149
150       -C PATH
151           Changes the current working directory before executing any specified
152           operations. This affects things like where cargo looks by default
153           for the project manifest (Cargo.toml), as well as the directories
154           searched for discovering .cargo/config.toml, for example. This
155           option must appear before the command name, for example cargo -C
156           path/to/my-project build.
157
158           This option is only available on the nightly channel
159           <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
160           requires the -Z unstable-options flag to enable (see #10098
161           <https://github.com/rust-lang/cargo/issues/10098>).
162
163       -h, --help
164           Prints help information.
165
166       -Z flag
167           Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
168           details.
169
170ENVIRONMENT
171       See the reference
172       <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
173       for details on environment variables that Cargo reads.
174
175EXIT STATUS
176       o  0: Cargo succeeded.
177
178       o  101: Cargo failed to complete.
179
180EXAMPLES
181       1. Retrieve package specification for foo package:
182
183              cargo pkgid foo
184
185       2. Retrieve package specification for version 1.0.0 of foo:
186
187              cargo pkgid foo@1.0.0
188
189       3. Retrieve package specification for foo from crates.io:
190
191              cargo pkgid https://github.com/rust-lang/crates.io-index#foo
192
193       4. Retrieve package specification for foo from a local package:
194
195              cargo pkgid file:///path/to/local/package#foo
196
197SEE ALSO
198       cargo(1), cargo-generate-lockfile(1), cargo-metadata(1), Package ID
199       Specifications
200       <https://doc.rust-lang.org/cargo/reference/pkgid-spec.html>, JSON
201       messages
202       <https://doc.rust-lang.org/cargo/reference/external-tools.html#json-messages>
203