fork/cargo
git clone https://git.julia.blue/fork/cargo
eb2be1326
0.89.0
1CARGO(1) 2 3NAME 4 cargo — The Rust package manager 5 6SYNOPSIS 7 cargo [options] command [args] 8 cargo [options] --version 9 cargo [options] --list 10 cargo [options] --help 11 cargo [options] --explain code 12 13DESCRIPTION 14 This program is a package manager and build tool for the Rust language, 15 available at <https://rust-lang.org>. 16 17COMMANDS 18 Build Commands 19 cargo-bench(1) 20 Execute benchmarks of a package. 21 22 cargo-build(1) 23 Compile a package. 24 25 cargo-check(1) 26 Check a local package and all of its dependencies for errors. 27 28 cargo-clean(1) 29 Remove artifacts that Cargo has generated in the past. 30 31 cargo-doc(1) 32 Build a package’s documentation. 33 34 cargo-fetch(1) 35 Fetch dependencies of a package from the network. 36 37 cargo-fix(1) 38 Automatically fix lint warnings reported by rustc. 39 40 cargo-run(1) 41 Run a binary or example of the local package. 42 43 cargo-rustc(1) 44 Compile a package, and pass extra options to the compiler. 45 46 cargo-rustdoc(1) 47 Build a package’s documentation, using specified custom flags. 48 49 cargo-test(1) 50 Execute unit and integration tests of a package. 51 52 Manifest Commands 53 cargo-add(1) 54 Add dependencies to a Cargo.toml manifest file. 55 56 cargo-generate-lockfile(1) 57 Generate Cargo.lock for a project. 58 59 cargo-info(1) 60 Display information about a package in the registry. Default 61 registry is crates.io. 62 63 cargo-locate-project(1) 64 Print a JSON representation of a Cargo.toml file’s location. 65 66 cargo-metadata(1) 67 Output the resolved dependencies of a package in 68 machine-readable format. 69 70 cargo-pkgid(1) 71 Print a fully qualified package specification. 72 73 cargo-remove(1) 74 Remove dependencies from a Cargo.toml manifest file. 75 76 cargo-tree(1) 77 Display a tree visualization of a dependency graph. 78 79 cargo-update(1) 80 Update dependencies as recorded in the local lock file. 81 82 cargo-vendor(1) 83 Vendor all dependencies locally. 84 85 Package Commands 86 cargo-init(1) 87 Create a new Cargo package in an existing directory. 88 89 cargo-install(1) 90 Build and install a Rust binary. 91 92 cargo-new(1) 93 Create a new Cargo package. 94 95 cargo-search(1) 96 Search packages in crates.io. 97 98 cargo-uninstall(1) 99 Remove a Rust binary. 100 101 Publishing Commands 102 cargo-login(1) 103 Save an API token from the registry locally. 104 105 cargo-logout(1) 106 Remove an API token from the registry locally. 107 108 cargo-owner(1) 109 Manage the owners of a crate on the registry. 110 111 cargo-package(1) 112 Assemble the local package into a distributable tarball. 113 114 cargo-publish(1) 115 Upload a package to the registry. 116 117 cargo-yank(1) 118 Remove a pushed crate from the index. 119 120 General Commands 121 cargo-help(1) 122 Display help information about Cargo. 123 124 cargo-version(1) 125 Show version information. 126 127OPTIONS 128 Special Options 129 -V, --version 130 Print version info and exit. If used with --verbose, prints extra 131 information. 132 133 --list 134 List all installed Cargo subcommands. If used with --verbose, prints 135 extra information. 136 137 --explain code 138 Run rustc --explain CODE which will print out a detailed explanation 139 of an error message (for example, E0004). 140 141 Display Options 142 -v, --verbose 143 Use verbose output. May be specified twice for “very verbose” 144 output which includes extra output such as dependency warnings and 145 build script output. May also be specified with the term.verbose 146 config value 147 <https://doc.rust-lang.org/cargo/reference/config.html>. 148 149 -q, --quiet 150 Do not print cargo log messages. May also be specified with the 151 term.quiet config value 152 <https://doc.rust-lang.org/cargo/reference/config.html>. 153 154 --color when 155 Control when colored output is used. Valid values: 156 157 o auto (default): Automatically detect if color support is 158 available on the terminal. 159 160 o always: Always display colors. 161 162 o never: Never display colors. 163 164 May also be specified with the term.color config value 165 <https://doc.rust-lang.org/cargo/reference/config.html>. 166 167 Manifest Options 168 --locked 169 Asserts that the exact same dependencies and versions are used as 170 when the existing Cargo.lock file was originally generated. Cargo 171 will exit with an error when either of the following scenarios 172 arises: 173 174 o The lock file is missing. 175 176 o Cargo attempted to change the lock file due to a different 177 dependency resolution. 178 179 It may be used in environments where deterministic builds are 180 desired, such as in CI pipelines. 181 182 --offline 183 Prevents Cargo from accessing the network for any reason. Without 184 this flag, Cargo will stop with an error if it needs to access the 185 network and the network is not available. With this flag, Cargo will 186 attempt to proceed without the network if possible. 187 188 Beware that this may result in different dependency resolution than 189 online mode. Cargo will restrict itself to crates that are 190 downloaded locally, even if there might be a newer version as 191 indicated in the local copy of the index. See the cargo-fetch(1) 192 command to download dependencies before going offline. 193 194 May also be specified with the net.offline config value 195 <https://doc.rust-lang.org/cargo/reference/config.html>. 196 197 --frozen 198 Equivalent to specifying both --locked and --offline. 199 200 Common Options 201 +toolchain 202 If Cargo has been installed with rustup, and the first argument to 203 cargo begins with +, it will be interpreted as a rustup toolchain 204 name (such as +stable or +nightly). See the rustup documentation 205 <https://rust-lang.github.io/rustup/overrides.html> for more 206 information about how toolchain overrides work. 207 208 --config KEY=VALUE or PATH 209 Overrides a Cargo configuration value. The argument should be in 210 TOML syntax of KEY=VALUE, or provided as a path to an extra 211 configuration file. This flag may be specified multiple times. See 212 the command-line overrides section 213 <https://doc.rust-lang.org/cargo/reference/config.html#command-line-overrides> 214 for more information. 215 216 -C PATH 217 Changes the current working directory before executing any specified 218 operations. This affects things like where cargo looks by default 219 for the project manifest (Cargo.toml), as well as the directories 220 searched for discovering .cargo/config.toml, for example. This 221 option must appear before the command name, for example cargo -C 222 path/to/my-project build. 223 224 This option is only available on the nightly channel 225 <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and 226 requires the -Z unstable-options flag to enable (see #10098 227 <https://github.com/rust-lang/cargo/issues/10098>). 228 229 -h, --help 230 Prints help information. 231 232 -Z flag 233 Unstable (nightly-only) flags to Cargo. Run cargo -Z help for 234 details. 235 236ENVIRONMENT 237 See the reference 238 <https://doc.rust-lang.org/cargo/reference/environment-variables.html> 239 for details on environment variables that Cargo reads. 240 241EXIT STATUS 242 o 0: Cargo succeeded. 243 244 o 101: Cargo failed to complete. 245 246FILES 247 ~/.cargo/ 248 Default location for Cargo’s “home” directory where it 249 stores various files. The location can be changed with the CARGO_HOME 250 environment variable. 251 252 $CARGO_HOME/bin/ 253 Binaries installed by cargo-install(1) will be located here. If 254 using rustup <https://rust-lang.github.io/rustup/>, executables 255 distributed with Rust are also located here. 256 257 $CARGO_HOME/config.toml 258 The global configuration file. See the reference 259 <https://doc.rust-lang.org/cargo/reference/config.html> for more 260 information about configuration files. 261 262 .cargo/config.toml 263 Cargo automatically searches for a file named .cargo/config.toml 264 in the current directory, and all parent directories. These 265 configuration files will be merged with the global configuration file. 266 267 $CARGO_HOME/credentials.toml 268 Private authentication information for logging in to a registry. 269 270 $CARGO_HOME/registry/ 271 This directory contains cached downloads of the registry index 272 and any downloaded dependencies. 273 274 $CARGO_HOME/git/ 275 This directory contains cached downloads of git dependencies. 276 277 Please note that the internal structure of the $CARGO_HOME directory is 278 not stable yet and may be subject to change. 279 280EXAMPLES 281 1. Build a local package and all of its dependencies: 282 283 cargo build 284 285 2. Build a package with optimizations: 286 287 cargo build --release 288 289 3. Run tests for a cross-compiled target: 290 291 cargo test --target i686-unknown-linux-gnu 292 293 4. Create a new package that builds an executable: 294 295 cargo new foobar 296 297 5. Create a package in the current directory: 298 299 mkdir foo && cd foo 300 cargo init . 301 302 6. Learn about a command’s options and usage: 303 304 cargo help clean 305 306BUGS 307 See <https://github.com/rust-lang/cargo/issues> for issues. 308 309SEE ALSO 310 rustc(1), rustdoc(1) 311