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