fork/cargo

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

borsAuto merge of #14620 - epage:guideless, r=weihanglo0473ee8b8

0.87.0
7.0 KiB173 linesraw
1CARGO-FETCH(1)
2
3NAME
4       cargo-fetch — Fetch dependencies of a package from the network
5
6SYNOPSIS
7       cargo fetch [options]
8
9DESCRIPTION
10       If a Cargo.lock file is available, this command will ensure that all of
11       the git dependencies and/or registry dependencies are downloaded and
12       locally available. Subsequent Cargo commands will be able to run offline
13       after a cargo fetch unless the lock file changes.
14
15       If the lock file is not available, then this command will generate the
16       lock file before fetching the dependencies.
17
18       If --target is not specified, then all target dependencies are fetched.
19
20       See also the cargo-prefetch <https://crates.io/crates/cargo-prefetch>
21       plugin which adds a command to download popular crates. This may be
22       useful if you plan to use Cargo without a network with the --offline
23       flag.
24
25OPTIONS
26   Fetch options
27       --target triple
28           Fetch for the given architecture. The default is all architectures.
29           The general format of the triple is
30           <arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
31           a list of supported targets. This flag may be specified multiple
32           times.
33
34           This may also be specified with the build.target config value
35           <https://doc.rust-lang.org/cargo/reference/config.html>.
36
37           Note that specifying this flag makes Cargo run in a different mode
38           where the target artifacts are placed in a separate directory. See
39           the build cache
40           <https://doc.rust-lang.org/cargo/reference/build-cache.html>
41           documentation for more details.
42
43   Display Options
44       -v, --verbose
45           Use verbose output. May be specified twice for “very verbose”
46           output which includes extra output such as dependency warnings and
47           build script output. May also be specified with the term.verbose
48           config value
49           <https://doc.rust-lang.org/cargo/reference/config.html>.
50
51       -q, --quiet
52           Do not print cargo log messages. May also be specified with the
53           term.quiet config value
54           <https://doc.rust-lang.org/cargo/reference/config.html>.
55
56       --color when
57           Control when colored output is used. Valid values:
58
59           o  auto (default): Automatically detect if color support is
60              available on the terminal.
61
62           o  always: Always display colors.
63
64           o  never: Never display colors.
65
66           May also be specified with the term.color config value
67           <https://doc.rust-lang.org/cargo/reference/config.html>.
68
69   Manifest Options
70       --manifest-path path
71           Path to the Cargo.toml file. By default, Cargo searches for the
72           Cargo.toml file in the current directory or any parent directory.
73
74       --locked
75           Asserts that the exact same dependencies and versions are used as
76           when the existing Cargo.lock file was originally generated. Cargo
77           will exit with an error when either of the following scenarios
78           arises:
79
80           o  The lock file is missing.
81
82           o  Cargo attempted to change the lock file due to a different
83              dependency resolution.
84
85           It may be used in environments where deterministic builds are
86           desired, such as in CI pipelines.
87
88       --offline
89           Prevents Cargo from accessing the network for any reason. Without
90           this flag, Cargo will stop with an error if it needs to access the
91           network and the network is not available. With this flag, Cargo will
92           attempt to proceed without the network if possible.
93
94           Beware that this may result in different dependency resolution than
95           online mode. Cargo will restrict itself to crates that are
96           downloaded locally, even if there might be a newer version as
97           indicated in the local copy of the index.
98
99           May also be specified with the net.offline config value
100           <https://doc.rust-lang.org/cargo/reference/config.html>.
101
102       --frozen
103           Equivalent to specifying both --locked and --offline.
104
105       --lockfile-path PATH
106           Changes the path of the lockfile from the default
107           (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock
108           (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that
109           providing --lockfile-path will ignore existing lockfile at the
110           default path, and instead will either use the lockfile from PATH, or
111           write a new lockfile into the provided PATH if it doesn’t exist.
112           This flag can be used to run most commands in read-only directories,
113           writing lockfile into the provided PATH.
114
115           This option is only available on the nightly channel
116           <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
117           requires the -Z unstable-options flag to enable (see #14421
118           <https://github.com/rust-lang/cargo/issues/14421>).
119
120   Common Options
121       +toolchain
122           If Cargo has been installed with rustup, and the first argument to
123           cargo begins with +, it will be interpreted as a rustup toolchain
124           name (such as +stable or +nightly). See the rustup documentation
125           <https://rust-lang.github.io/rustup/overrides.html> for more
126           information about how toolchain overrides work.
127
128       --config KEY=VALUE or PATH
129           Overrides a Cargo configuration value. The argument should be in
130           TOML syntax of KEY=VALUE, or provided as a path to an extra
131           configuration file. This flag may be specified multiple times. See
132           the command-line overrides section
133           <https://doc.rust-lang.org/cargo/reference/config.html#command-line-overrides>
134           for more information.
135
136       -C PATH
137           Changes the current working directory before executing any specified
138           operations. This affects things like where cargo looks by default
139           for the project manifest (Cargo.toml), as well as the directories
140           searched for discovering .cargo/config.toml, for example. This
141           option must appear before the command name, for example cargo -C
142           path/to/my-project build.
143
144           This option is only available on the nightly channel
145           <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
146           requires the -Z unstable-options flag to enable (see #10098
147           <https://github.com/rust-lang/cargo/issues/10098>).
148
149       -h, --help
150           Prints help information.
151
152       -Z flag
153           Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
154           details.
155
156ENVIRONMENT
157       See the reference
158       <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
159       for details on environment variables that Cargo reads.
160
161EXIT STATUS
162       o  0: Cargo succeeded.
163
164       o  101: Cargo failed to complete.
165
166EXAMPLES
167       1. Fetch all dependencies:
168
169              cargo fetch
170
171SEE ALSO
172       cargo(1), cargo-update(1), cargo-generate-lockfile(1)
173