fork/cargo

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

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

0.91.0
8.7 KiB219 linesraw
1CARGO-UPDATE(1)
2
3NAME
4       cargo-update — Update dependencies as recorded in the local lock file
5
6SYNOPSIS
7       cargo update [options] spec
8
9DESCRIPTION
10       This command will update dependencies in the Cargo.lock file to the
11       latest version. If the Cargo.lock file does not exist, it will be
12       created with the latest available versions.
13
14OPTIONS
15   Update Options
16       spec…
17           Update only the specified packages. This flag may be specified
18           multiple times. See cargo-pkgid(1) for the SPEC format.
19
20           If packages are specified with spec, then a conservative update of
21           the lockfile will be performed. This means that only the dependency
22           specified by SPEC will be updated. Its transitive dependencies will
23           be updated only if SPEC cannot be updated without updating
24           dependencies. All other dependencies will remain locked at their
25           currently recorded versions.
26
27           If spec is not specified, all dependencies are updated.
28
29       --recursive
30           When used with spec, dependencies of spec are forced to update as
31           well. Cannot be used with --precise.
32
33       --precise precise
34           When used with spec, allows you to specify a specific version number
35           to set the package to. If the package comes from a git repository,
36           this can be a git revision (such as a SHA hash or tag).
37
38           While not recommended, you can specify a yanked version of a
39           package. When possible, try other non-yanked SemVer-compatible
40           versions or seek help from the maintainers of the package.
41
42           A compatible pre-release version can also be specified even when the
43           version requirement in Cargo.toml doesn’t contain any pre-release
44           identifier (nightly only).
45
46       --breaking directory
47           Update spec to latest SemVer-breaking version.
48
49           Version requirements will be modified to allow this update.
50
51           This only applies to dependencies when
52
53           o  The package is a dependency of a workspace member
54
55           o  The dependency is not renamed
56
57           o  A SemVer-incompatible version is available
58
59           o  The “SemVer operator” is used (^ which is the default)
60
61           This option is unstable and available only on the nightly channel
62           <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
63           requires the -Z unstable-options flag to enable. See
64           <https://github.com/rust-lang/cargo/issues/12425> for more
65           information.
66
67       -w, --workspace
68           Attempt to update only packages defined in the workspace. Other
69           packages are updated only if they don’t already exist in the
70           lockfile. This option is useful for updating Cargo.lock after
71           you’ve changed version numbers in Cargo.toml.
72
73       --dry-run
74           Displays what would be updated, but doesn’t actually write the
75           lockfile.
76
77   Display Options
78       -v, --verbose
79           Use verbose output. May be specified twice for “very verbose”
80           output which includes extra output such as dependency warnings and
81           build script output. May also be specified with the term.verbose
82           config value
83           <https://doc.rust-lang.org/cargo/reference/config.html>.
84
85       -q, --quiet
86           Do not print cargo log messages. May also be specified with the
87           term.quiet config value
88           <https://doc.rust-lang.org/cargo/reference/config.html>.
89
90       --color when
91           Control when colored output is used. Valid values:
92
93           o  auto (default): Automatically detect if color support is
94              available on the terminal.
95
96           o  always: Always display colors.
97
98           o  never: Never display colors.
99
100           May also be specified with the term.color config value
101           <https://doc.rust-lang.org/cargo/reference/config.html>.
102
103   Manifest Options
104       --manifest-path path
105           Path to the Cargo.toml file. By default, Cargo searches for the
106           Cargo.toml file in the current directory or any parent directory.
107
108       --ignore-rust-version
109           Ignore rust-version specification in packages.
110
111       --locked
112           Asserts that the exact same dependencies and versions are used as
113           when the existing Cargo.lock file was originally generated. Cargo
114           will exit with an error when either of the following scenarios
115           arises:
116
117           o  The lock file is missing.
118
119           o  Cargo attempted to change the lock file due to a different
120              dependency resolution.
121
122           It may be used in environments where deterministic builds are
123           desired, such as in CI pipelines.
124
125       --offline
126           Prevents Cargo from accessing the network for any reason. Without
127           this flag, Cargo will stop with an error if it needs to access the
128           network and the network is not available. With this flag, Cargo will
129           attempt to proceed without the network if possible.
130
131           Beware that this may result in different dependency resolution than
132           online mode. Cargo will restrict itself to crates that are
133           downloaded locally, even if there might be a newer version as
134           indicated in the local copy of the index. See the cargo-fetch(1)
135           command to download dependencies before going offline.
136
137           May also be specified with the net.offline config value
138           <https://doc.rust-lang.org/cargo/reference/config.html>.
139
140       --frozen
141           Equivalent to specifying both --locked and --offline.
142
143       --lockfile-path PATH
144           Changes the path of the lockfile from the default
145           (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock
146           (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that
147           providing --lockfile-path will ignore existing lockfile at the
148           default path, and instead will either use the lockfile from PATH, or
149           write a new lockfile into the provided PATH if it doesn’t exist.
150           This flag can be used to run most commands in read-only directories,
151           writing lockfile into the provided PATH.
152
153           This option is only available on the nightly channel
154           <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
155           requires the -Z unstable-options flag to enable (see #14421
156           <https://github.com/rust-lang/cargo/issues/14421>).
157
158   Common Options
159       +toolchain
160           If Cargo has been installed with rustup, and the first argument to
161           cargo begins with +, it will be interpreted as a rustup toolchain
162           name (such as +stable or +nightly). See the rustup documentation
163           <https://rust-lang.github.io/rustup/overrides.html> for more
164           information about how toolchain overrides work.
165
166       --config KEY=VALUE or PATH
167           Overrides a Cargo configuration value. The argument should be in
168           TOML syntax of KEY=VALUE, or provided as a path to an extra
169           configuration file. This flag may be specified multiple times. See
170           the command-line overrides section
171           <https://doc.rust-lang.org/cargo/reference/config.html#command-line-overrides>
172           for more information.
173
174       -C PATH
175           Changes the current working directory before executing any specified
176           operations. This affects things like where cargo looks by default
177           for the project manifest (Cargo.toml), as well as the directories
178           searched for discovering .cargo/config.toml, for example. This
179           option must appear before the command name, for example cargo -C
180           path/to/my-project build.
181
182           This option is only available on the nightly channel
183           <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
184           requires the -Z unstable-options flag to enable (see #10098
185           <https://github.com/rust-lang/cargo/issues/10098>).
186
187       -h, --help
188           Prints help information.
189
190       -Z flag
191           Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
192           details.
193
194ENVIRONMENT
195       See the reference
196       <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
197       for details on environment variables that Cargo reads.
198
199EXIT STATUS
200       o  0: Cargo succeeded.
201
202       o  101: Cargo failed to complete.
203
204EXAMPLES
205       1. Update all dependencies in the lockfile:
206
207              cargo update
208
209       2. Update only specific dependencies:
210
211              cargo update foo bar
212
213       3. Set a specific dependency to a specific version:
214
215              cargo update foo --precise 1.2.3
216
217SEE ALSO
218       cargo(1), cargo-generate-lockfile(1)
219