blob: 1afb47c2de3adfe05679ae58a57783c99d5d5a13 [file] [log] [blame]
Matthew Maurerbd398542019-09-05 16:25:08 -07001'\" t
2.\" Title: cargo-clean
3.\" Author: [see the "AUTHOR(S)" section]
4.\" Generator: Asciidoctor 1.5.8
5.\" Date: 2019-04-16
6.\" Manual: \ \&
7.\" Source: \ \&
8.\" Language: English
9.\"
10.TH "CARGO\-CLEAN" "1" "2019-04-16" "\ \&" "\ \&"
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\-clean \- Remove generated artifacts
32.SH "SYNOPSIS"
33.sp
34\fBcargo clean [\fIOPTIONS\fP]\fP
35.SH "DESCRIPTION"
36.sp
37Remove artifacts from the target directory that Cargo has generated in the
38past.
39.sp
40With no options, \fBcargo clean\fP will delete the entire target directory.
41.SH "OPTIONS"
42.SS "Package Selection"
43.sp
44When no packages are selected, all packages and all dependencies in the
45workspace are cleaned.
46.sp
47\fB\-p\fP \fISPEC\fP..., \fB\-\-package\fP \fISPEC\fP...
48.RS 4
49Clean only the specified packages. This flag may be specified
50multiple times. See \fBcargo\-pkgid\fP(1) for the SPEC format.
51.RE
52.SS "Clean Options"
53.sp
54\fB\-\-doc\fP
55.RS 4
56This option will cause \fBcargo clean\fP to remove only the \fBdoc\fP directory in
57the target directory.
58.RE
59.sp
60\fB\-\-release\fP
61.RS 4
62Clean all artifacts that were built with the \fBrelease\fP or \fBbench\fP
63profiles.
64.RE
65.sp
66\fB\-\-target\-dir\fP \fIDIRECTORY\fP
67.RS 4
68Directory for all generated artifacts and intermediate files. May also be
69specified with the \fBCARGO_TARGET_DIR\fP environment variable, or the
70\fBbuild.target\-dir\fP \c
71.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
72Defaults
73to \fBtarget\fP in the root of the workspace.
74.RE
75.sp
76\fB\-\-target\fP \fITRIPLE\fP
77.RS 4
78Clean for the given architecture. The default is the host
79architecture. The general format of the triple is
80\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fP. Run \fBrustc \-\-print target\-list\fP for a
81list of supported targets.
82.sp
83This may also be specified with the \fBbuild.target\fP
84.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
85.RE
86.SS "Display Options"
87.sp
88\fB\-v\fP, \fB\-\-verbose\fP
89.RS 4
90Use verbose output. May be specified twice for "very verbose" output which
91includes extra output such as dependency warnings and build script output.
92May also be specified with the \fBterm.verbose\fP
93.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
94.RE
95.sp
96\fB\-q\fP, \fB\-\-quiet\fP
97.RS 4
98No output printed to stdout.
99.RE
100.sp
101\fB\-\-color\fP \fIWHEN\fP
102.RS 4
103Control when colored output is used. Valid values:
104.sp
105.RS 4
106.ie n \{\
107\h'-04'\(bu\h'+03'\c
108.\}
109.el \{\
110. sp -1
111. IP \(bu 2.3
112.\}
113\fBauto\fP (default): Automatically detect if color support is available on the
114terminal.
115.RE
116.sp
117.RS 4
118.ie n \{\
119\h'-04'\(bu\h'+03'\c
120.\}
121.el \{\
122. sp -1
123. IP \(bu 2.3
124.\}
125\fBalways\fP: Always display colors.
126.RE
127.sp
128.RS 4
129.ie n \{\
130\h'-04'\(bu\h'+03'\c
131.\}
132.el \{\
133. sp -1
134. IP \(bu 2.3
135.\}
136\fBnever\fP: Never display colors.
137.RE
138.sp
139May also be specified with the \fBterm.color\fP
140.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
141.RE
142.SS "Manifest Options"
143.sp
144\fB\-\-manifest\-path\fP \fIPATH\fP
145.RS 4
146Path to the \fBCargo.toml\fP file. By default, Cargo searches in the current
147directory or any parent directory for the \fBCargo.toml\fP file.
148.RE
149.sp
150\fB\-\-frozen\fP, \fB\-\-locked\fP
151.RS 4
152Either of these flags requires that the \fBCargo.lock\fP file is
153up\-to\-date. If the lock file is missing, or it needs to be updated, Cargo will
154exit with an error. The \fB\-\-frozen\fP flag also prevents Cargo from
155attempting to access the network to determine if it is out\-of\-date.
156.sp
157These may be used in environments where you want to assert that the
158\fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network
159access.
160.RE
161.sp
162\fB\-\-offline\fP
163.RS 4
164Prevents Cargo from accessing the network for any reason. Without this
165flag, Cargo will stop with an error if it needs to access the network and
166the network is not available. With this flag, Cargo will attempt to
167proceed without the network if possible.
168.sp
169Beware that this may result in different dependency resolution than online
170mode. Cargo will restrict itself to crates that are downloaded locally, even
171if there might be a newer version as indicated in the local copy of the index.
172See the \fBcargo\-fetch\fP(1) command to download dependencies before going
173offline.
174.sp
175May also be specified with the \fBnet.offline\fP \c
176.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
177.RE
178.SS "Common Options"
179.sp
180\fB\-h\fP, \fB\-\-help\fP
181.RS 4
182Prints help information.
183.RE
184.sp
185\fB\-Z\fP \fIFLAG\fP...
186.RS 4
187Unstable (nightly\-only) flags to Cargo. Run \fBcargo \-Z help\fP for
188details.
189.RE
190.SH "ENVIRONMENT"
191.sp
192See \c
193.URL "https://doc.rust\-lang.org/cargo/reference/environment\-variables.html" "the reference" " "
194for
195details on environment variables that Cargo reads.
196.SH "EXIT STATUS"
197.sp
1980
199.RS 4
200Cargo succeeded.
201.RE
202.sp
203101
204.RS 4
205Cargo failed to complete.
206.RE
207.SH "EXAMPLES"
208.sp
209.RS 4
210.ie n \{\
211\h'-04' 1.\h'+01'\c
212.\}
213.el \{\
214. sp -1
215. IP " 1." 4.2
216.\}
217Remove the entire target directory:
218.sp
219.if n .RS 4
220.nf
221cargo clean
222.fi
223.if n .RE
224.RE
225.sp
226.RS 4
227.ie n \{\
228\h'-04' 2.\h'+01'\c
229.\}
230.el \{\
231. sp -1
232. IP " 2." 4.2
233.\}
234Remove only the release artifacts:
235.sp
236.if n .RS 4
237.nf
238cargo clean \-\-release
239.fi
240.if n .RE
241.RE
242.SH "SEE ALSO"
243.sp
244\fBcargo\fP(1), \fBcargo\-build\fP(1)