blob: 0a4225de40e8cbe79602a7b2d453eebd044aa940 [file] [log] [blame]
Jeff Vander Stoep956d1432020-09-18 13:46:24 +02001'\" t
2.\" Title: cargo-fetch
3.\" Author: [see the "AUTHOR(S)" section]
4.\" Generator: Asciidoctor 2.0.10
5.\" Date: 2019-11-11
6.\" Manual: \ \&
7.\" Source: \ \&
8.\" Language: English
9.\"
10.TH "CARGO\-FETCH" "1" "2019-11-11" "\ \&" "\ \&"
11.ie \n(.g .ds Aq \(aq
12.el .ds Aq '
13.ss \n[.ss] 0
14.nh
15.ad l
16.de URL
17\fI\\$2\fP <\\$1>\\$3
18..
19.als MTO URL
20.if \n[.g] \{\
21. mso www.tmac
22. am URL
23. ad l
24. .
25. am MTO
26. ad l
27. .
28. LINKSTYLE blue R < >
29.\}
30.SH "NAME"
31cargo\-fetch \- Fetch dependencies of a package from the network
32.SH "SYNOPSIS"
33.sp
34\fBcargo fetch [\fIOPTIONS\fP]\fP
35.SH "DESCRIPTION"
36.sp
37If a \fBCargo.lock\fP file is available, this command will ensure that all of the
38git dependencies and/or registry dependencies are downloaded and locally
39available. Subsequent Cargo commands never touch the network after a \fBcargo
40fetch\fP unless the lock file changes.
41.sp
42If the lock file is not available, then this command will generate the lock
43file before fetching the dependencies.
44.sp
45If \fB\-\-target\fP is not specified, then all target dependencies are fetched.
46.sp
47See also the \c
48.URL "https://crates.io/crates/cargo\-prefetch" "cargo\-prefetch"
49plugin which adds a command to download popular crates. This may be useful if
50you plan to use Cargo without a network with the \fB\-\-offline\fP flag.
51.SH "OPTIONS"
52.SS "Fetch options"
53.sp
54\fB\-\-target\fP \fITRIPLE\fP
55.RS 4
56Fetch for the given architecture. The default is the host
57architecture. The general format of the triple is
58\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fP. Run \fBrustc \-\-print target\-list\fP for a
59list of supported targets.
60.sp
61This may also be specified with the \fBbuild.target\fP
62.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
63.sp
64Note that specifying this flag makes Cargo run in a different mode where the
65target artifacts are placed in a separate directory. See the
66.URL "https://doc.rust\-lang.org/cargo/guide/build\-cache.html" "build cache" " "
67documentation for more details.
68.RE
69.SS "Display Options"
70.sp
71\fB\-v\fP, \fB\-\-verbose\fP
72.RS 4
73Use verbose output. May be specified twice for "very verbose" output which
74includes extra output such as dependency warnings and build script output.
75May also be specified with the \fBterm.verbose\fP
76.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
77.RE
78.sp
79\fB\-q\fP, \fB\-\-quiet\fP
80.RS 4
81No output printed to stdout.
82.RE
83.sp
84\fB\-\-color\fP \fIWHEN\fP
85.RS 4
86Control when colored output is used. Valid values:
87.sp
88.RS 4
89.ie n \{\
90\h'-04'\(bu\h'+03'\c
91.\}
92.el \{\
93. sp -1
94. IP \(bu 2.3
95.\}
96\fBauto\fP (default): Automatically detect if color support is available on the
97terminal.
98.RE
99.sp
100.RS 4
101.ie n \{\
102\h'-04'\(bu\h'+03'\c
103.\}
104.el \{\
105. sp -1
106. IP \(bu 2.3
107.\}
108\fBalways\fP: Always display colors.
109.RE
110.sp
111.RS 4
112.ie n \{\
113\h'-04'\(bu\h'+03'\c
114.\}
115.el \{\
116. sp -1
117. IP \(bu 2.3
118.\}
119\fBnever\fP: Never display colors.
120.RE
121.sp
122May also be specified with the \fBterm.color\fP
123.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
124.RE
125.SS "Manifest Options"
126.sp
127\fB\-\-manifest\-path\fP \fIPATH\fP
128.RS 4
129Path to the \fBCargo.toml\fP file. By default, Cargo searches for the
130\fBCargo.toml\fP file in the current directory or any parent directory.
131.RE
132.sp
133\fB\-\-frozen\fP, \fB\-\-locked\fP
134.RS 4
135Either of these flags requires that the \fBCargo.lock\fP file is
136up\-to\-date. If the lock file is missing, or it needs to be updated, Cargo will
137exit with an error. The \fB\-\-frozen\fP flag also prevents Cargo from
138attempting to access the network to determine if it is out\-of\-date.
139.sp
140These may be used in environments where you want to assert that the
141\fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network
142access.
143.RE
144.sp
145\fB\-\-offline\fP
146.RS 4
147Prevents Cargo from accessing the network for any reason. Without this
148flag, Cargo will stop with an error if it needs to access the network and
149the network is not available. With this flag, Cargo will attempt to
150proceed without the network if possible.
151.sp
152Beware that this may result in different dependency resolution than online
153mode. Cargo will restrict itself to crates that are downloaded locally, even
154if there might be a newer version as indicated in the local copy of the index.
155See the \fBcargo\-fetch\fP(1) command to download dependencies before going
156offline.
157.sp
158May also be specified with the \fBnet.offline\fP \c
159.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
160.RE
161.SS "Common Options"
162.sp
163\fB+TOOLCHAIN\fP
164.RS 4
165If Cargo has been installed with rustup, and the first argument to \fBcargo\fP
166begins with \fB+\fP, it will be interpreted as a rustup toolchain name (such
167as \fB+stable\fP or \fB+nightly\fP).
168See the \c
169.URL "https://github.com/rust\-lang/rustup/" "rustup documentation"
170for more information about how toolchain overrides work.
171.RE
172.sp
173\fB\-h\fP, \fB\-\-help\fP
174.RS 4
175Prints help information.
176.RE
177.sp
178\fB\-Z\fP \fIFLAG\fP...
179.RS 4
180Unstable (nightly\-only) flags to Cargo. Run \fBcargo \-Z help\fP for
181details.
182.RE
183.SH "ENVIRONMENT"
184.sp
185See \c
186.URL "https://doc.rust\-lang.org/cargo/reference/environment\-variables.html" "the reference" " "
187for
188details on environment variables that Cargo reads.
189.SH "EXIT STATUS"
190.sp
1910
192.RS 4
193Cargo succeeded.
194.RE
195.sp
196101
197.RS 4
198Cargo failed to complete.
199.RE
200.SH "EXAMPLES"
201.sp
202.RS 4
203.ie n \{\
204\h'-04' 1.\h'+01'\c
205.\}
206.el \{\
207. sp -1
208. IP " 1." 4.2
209.\}
210Fetch all dependencies:
211.sp
212.if n .RS 4
213.nf
214cargo fetch
215.fi
216.if n .RE
217.RE
218.SH "SEE ALSO"
219.sp
220\fBcargo\fP(1), \fBcargo\-update\fP(1), \fBcargo\-generate\-lockfile\fP(1)