fork/cargo

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

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

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