1CARGO-FETCH(1)              General Commands Manual             CARGO-FETCH(1)
2
3
4

NAME

6       cargo-fetch - Fetch dependencies of a package from the network
7

SYNOPSIS

9       cargo fetch [options]
10

DESCRIPTION

12       If a Cargo.lock file is available, this command will ensure that all of
13       the git dependencies and/or registry dependencies are downloaded and
14       locally available. Subsequent Cargo commands never touch the network
15       after a cargo fetch unless the lock file changes.
16
17       If the lock file is not available, then this command will generate the
18       lock file before fetching the dependencies.
19
20       If --target is not specified, then all target dependencies are fetched.
21
22       See also the cargo-prefetch <https://crates.io/crates/cargo-prefetch>
23       plugin which adds a command to download popular crates. This may be
24       useful if you plan to use Cargo without a network with the --offline
25       flag.
26

OPTIONS

28   Fetch options
29       --target triple
30           Fetch for the given architecture. The default is the host
31           architecture. The general format of the triple is
32           <arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
33           a list of supported targets.
34
35           This may also be specified with the build.target config value
36           <https://doc.rust-lang.org/cargo/reference/config.html>.
37
38           Note that specifying this flag makes Cargo run in a different mode
39           where the target artifacts are placed in a separate directory. See
40           the build cache
41           <https://doc.rust-lang.org/cargo/guide/build-cache.html>
42           documentation for more details.
43
44   Display Options
45       -v, --verbose
46           Use verbose output. May be specified twice for "very verbose"
47           output which includes extra output such as dependency warnings and
48           build script output. May also be specified with the term.verbose
49           config value
50           <https://doc.rust-lang.org/cargo/reference/config.html>.
51
52       -q, --quiet
53           No output printed to stdout.
54
55       --color when
56           Control when colored output is used. Valid values:
57
58           ·  auto (default): Automatically detect if color support is
59               available on the terminal.
60
61           ·  always: Always display colors.
62
63           ·  never: Never display colors.
64
65           May also be specified with the term.color config value
66           <https://doc.rust-lang.org/cargo/reference/config.html>.
67
68   Manifest Options
69       --manifest-path path
70           Path to the Cargo.toml file. By default, Cargo searches for the
71           Cargo.toml file in the current directory or any parent directory.
72
73       --frozen, --locked
74           Either of these flags requires that the Cargo.lock file is
75           up-to-date. If the lock file is missing, or it needs to be updated,
76           Cargo will exit with an error. The --frozen flag also prevents
77           Cargo from attempting to access the network to determine if it is
78           out-of-date.
79
80           These may be used in environments where you want to assert that the
81           Cargo.lock file is up-to-date (such as a CI build) or want to avoid
82           network access.
83
84       --offline
85           Prevents Cargo from accessing the network for any reason. Without
86           this flag, Cargo will stop with an error if it needs to access the
87           network and the network is not available. With this flag, Cargo
88           will attempt to proceed without the network if possible.
89
90           Beware that this may result in different dependency resolution than
91           online mode. Cargo will restrict itself to crates that are
92           downloaded locally, even if there might be a newer version as
93           indicated in the local copy of the index. See the cargo-fetch(1)
94           command to download dependencies before going offline.
95
96           May also be specified with the net.offline config value
97           <https://doc.rust-lang.org/cargo/reference/config.html>.
98
99   Common Options
100       +toolchain
101           If Cargo has been installed with rustup, and the first argument to
102           cargo begins with +, it will be interpreted as a rustup toolchain
103           name (such as +stable or +nightly). See the rustup documentation
104           <https://rust-lang.github.io/rustup/overrides.html> for more
105           information about how toolchain overrides work.
106
107       -h, --help
108           Prints help information.
109
110       -Z flag
111           Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
112           details.
113

ENVIRONMENT

115       See the reference
116       <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
117       for details on environment variables that Cargo reads.
118

EXIT STATUS

120       ·  0: Cargo succeeded.
121
122       ·  101: Cargo failed to complete.
123

EXAMPLES

125        1. Fetch all dependencies:
126
127               cargo fetch
128

SEE ALSO

130       cargo(1), cargo-update(1), cargo-generate-lockfile(1)
131
132
133
134                                                                CARGO-FETCH(1)
Impressum