fork/cargo
git clone https://git.julia.blue/fork/cargo
5b220de42
0.87.0
1CARGO-PUBLISH(1) 2 3NAME 4 cargo-publish — Upload a package to the registry 5 6SYNOPSIS 7 cargo publish [options] 8 9DESCRIPTION 10 This command will create a distributable, compressed .crate file with 11 the source code of the package in the current directory and upload it to 12 a registry. The default registry is <https://crates.io>. This performs 13 the following steps: 14 15 1. Performs a few checks, including: 16 o Checks the package.publish key in the manifest for restrictions on 17 which registries you are allowed to publish to. 18 19 2. Create a .crate file by following the steps in cargo-package(1). 20 21 3. Upload the crate to the registry. The server will perform additional 22 checks on the crate. 23 24 4. The client will poll waiting for the package to appear in the index, 25 and may timeout. In that case, you will need to check for completion 26 manually. This timeout does not affect the upload. 27 28 This command requires you to be authenticated with either the --token 29 option or using cargo-login(1). 30 31 See the reference 32 <https://doc.rust-lang.org/cargo/reference/publishing.html> for more 33 details about packaging and publishing. 34 35OPTIONS 36 Publish Options 37 --dry-run 38 Perform all checks without uploading. 39 40 --token token 41 API token to use when authenticating. This overrides the token 42 stored in the credentials file (which is created by cargo-login(1)). 43 44 Cargo config <https://doc.rust-lang.org/cargo/reference/config.html> 45 environment variables can be used to override the tokens stored in 46 the credentials file. The token for crates.io may be specified with 47 the CARGO_REGISTRY_TOKEN environment variable. Tokens for other 48 registries may be specified with environment variables of the form 49 CARGO_REGISTRIES_NAME_TOKEN where NAME is the name of the registry 50 in all capital letters. 51 52 --no-verify 53 Don’t verify the contents by building them. 54 55 --allow-dirty 56 Allow working directories with uncommitted VCS changes to be 57 packaged. 58 59 --index index 60 The URL of the registry index to use. 61 62 --registry registry 63 Name of the registry to publish to. Registry names are defined in 64 Cargo config files 65 <https://doc.rust-lang.org/cargo/reference/config.html>. If not 66 specified, and there is a package.publish 67 <https://doc.rust-lang.org/cargo/reference/manifest.html#the-publish-field> 68 field in Cargo.toml with a single registry, then it will publish to 69 that registry. Otherwise it will use the default registry, which is 70 defined by the registry.default 71 <https://doc.rust-lang.org/cargo/reference/config.html#registrydefault> 72 config key which defaults to crates-io. 73 74 Package Selection 75 By default, when no package selection options are given, the packages 76 selected depend on the selected manifest file (based on the current 77 working directory if --manifest-path is not given). If the manifest is 78 the root of a workspace then the workspaces default members are 79 selected, otherwise only the package defined by the manifest will be 80 selected. 81 82 The default members of a workspace can be set explicitly with the 83 workspace.default-members key in the root manifest. If this is not set, 84 a virtual workspace will include all workspace members (equivalent to 85 passing --workspace), and a non-virtual workspace will include only the 86 root crate itself. 87 88 Selecting more than one package is unstable and available only on the 89 nightly channel 90 <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and 91 requires the -Z package-workspace flag to enable. See 92 <https://github.com/rust-lang/cargo/issues/10948> for more information. 93 94 -p spec…, --package spec… 95 Publish only the specified packages. See cargo-pkgid(1) for the SPEC 96 format. This flag may be specified multiple times and supports 97 common Unix glob patterns like *, ? and []. However, to avoid your 98 shell accidentally expanding glob patterns before Cargo handles 99 them, you must use single quotes or double quotes around each 100 pattern. 101 102Selecting more than one package with this option is unstable and available only 103 104on the 105 106[nightly channel](https://doc.rust-lang.org/book/appendix-07-nightly-rust.html) 107 108and requires the `-Z package-workspace` flag to enable. 109 110See <https://github.com/rust-lang/cargo/issues/10948> for more information. 111 112 --workspace 113 Publish all members in the workspace. 114 115 This option is unstable and available only on the nightly channel 116 <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and 117 requires the -Z package-workspace flag to enable. See 118 <https://github.com/rust-lang/cargo/issues/10948> for more 119 information. 120 121 --exclude SPEC… 122 Exclude the specified packages. Must be used in conjunction with the 123 --workspace flag. This flag may be specified multiple times and 124 supports common Unix glob patterns like *, ? and []. However, to 125 avoid your shell accidentally expanding glob patterns before Cargo 126 handles them, you must use single quotes or double quotes around 127 each pattern. 128 129 This option is unstable and available only on the nightly channel 130 <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and 131 requires the -Z package-workspace flag to enable. See 132 <https://github.com/rust-lang/cargo/issues/10948> for more 133 information. 134 135 Compilation Options 136 --target triple 137 Publish for the given architecture. The default is the host 138 architecture. The general format of the triple is 139 <arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for 140 a list of supported targets. This flag may be specified multiple 141 times. 142 143 This may also be specified with the build.target config value 144 <https://doc.rust-lang.org/cargo/reference/config.html>. 145 146 Note that specifying this flag makes Cargo run in a different mode 147 where the target artifacts are placed in a separate directory. See 148 the build cache 149 <https://doc.rust-lang.org/cargo/reference/build-cache.html> 150 documentation for more details. 151 152 --target-dir directory 153 Directory for all generated artifacts and intermediate files. May 154 also be specified with the CARGO_TARGET_DIR environment variable, or 155 the build.target-dir config value 156 <https://doc.rust-lang.org/cargo/reference/config.html>. Defaults to 157 target in the root of the workspace. 158 159 Feature Selection 160 The feature flags allow you to control which features are enabled. When 161 no feature options are given, the default feature is activated for every 162 selected package. 163 164 See the features documentation 165 <https://doc.rust-lang.org/cargo/reference/features.html#command-line-feature-options> 166 for more details. 167 168 -F features, --features features 169 Space or comma separated list of features to activate. Features of 170 workspace members may be enabled with package-name/feature-name 171 syntax. This flag may be specified multiple times, which enables all 172 specified features. 173 174 --all-features 175 Activate all available features of all selected packages. 176 177 --no-default-features 178 Do not activate the default feature of the selected packages. 179 180 Manifest Options 181 --manifest-path path 182 Path to the Cargo.toml file. By default, Cargo searches for the 183 Cargo.toml file in the current directory or any parent directory. 184 185 --locked 186 Asserts that the exact same dependencies and versions are used as 187 when the existing Cargo.lock file was originally generated. Cargo 188 will exit with an error when either of the following scenarios 189 arises: 190 191 o The lock file is missing. 192 193 o Cargo attempted to change the lock file due to a different 194 dependency resolution. 195 196 It may be used in environments where deterministic builds are 197 desired, such as in CI pipelines. 198 199 --offline 200 Prevents Cargo from accessing the network for any reason. Without 201 this flag, Cargo will stop with an error if it needs to access the 202 network and the network is not available. With this flag, Cargo will 203 attempt to proceed without the network if possible. 204 205 Beware that this may result in different dependency resolution than 206 online mode. Cargo will restrict itself to crates that are 207 downloaded locally, even if there might be a newer version as 208 indicated in the local copy of the index. See the cargo-fetch(1) 209 command to download dependencies before going offline. 210 211 May also be specified with the net.offline config value 212 <https://doc.rust-lang.org/cargo/reference/config.html>. 213 214 --frozen 215 Equivalent to specifying both --locked and --offline. 216 217 --lockfile-path PATH 218 Changes the path of the lockfile from the default 219 (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock 220 (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that 221 providing --lockfile-path will ignore existing lockfile at the 222 default path, and instead will either use the lockfile from PATH, or 223 write a new lockfile into the provided PATH if it doesn’t exist. 224 This flag can be used to run most commands in read-only directories, 225 writing lockfile into the provided PATH. 226 227 This option is only available on the nightly channel 228 <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and 229 requires the -Z unstable-options flag to enable (see #14421 230 <https://github.com/rust-lang/cargo/issues/14421>). 231 232 Miscellaneous Options 233 -j N, --jobs N 234 Number of parallel jobs to run. May also be specified with the 235 build.jobs config value 236 <https://doc.rust-lang.org/cargo/reference/config.html>. Defaults to 237 the number of logical CPUs. If negative, it sets the maximum number 238 of parallel jobs to the number of logical CPUs plus provided value. 239 If a string default is provided, it sets the value back to defaults. 240 Should not be 0. 241 242 --keep-going 243 Build as many crates in the dependency graph as possible, rather 244 than aborting the build on the first one that fails to build. 245 246 For example if the current package depends on dependencies fails and 247 works, one of which fails to build, cargo publish -j1 may or may not 248 build the one that succeeds (depending on which one of the two 249 builds Cargo picked to run first), whereas cargo publish -j1 250 --keep-going would definitely run both builds, even if the one run 251 first fails. 252 253 Display Options 254 -v, --verbose 255 Use verbose output. May be specified twice for “very verbose” 256 output which includes extra output such as dependency warnings and 257 build script output. May also be specified with the term.verbose 258 config value 259 <https://doc.rust-lang.org/cargo/reference/config.html>. 260 261 -q, --quiet 262 Do not print cargo log messages. May also be specified with the 263 term.quiet config value 264 <https://doc.rust-lang.org/cargo/reference/config.html>. 265 266 --color when 267 Control when colored output is used. Valid values: 268 269 o auto (default): Automatically detect if color support is 270 available on the terminal. 271 272 o always: Always display colors. 273 274 o never: Never display colors. 275 276 May also be specified with the term.color config value 277 <https://doc.rust-lang.org/cargo/reference/config.html>. 278 279 Common Options 280 +toolchain 281 If Cargo has been installed with rustup, and the first argument to 282 cargo begins with +, it will be interpreted as a rustup toolchain 283 name (such as +stable or +nightly). See the rustup documentation 284 <https://rust-lang.github.io/rustup/overrides.html> for more 285 information about how toolchain overrides work. 286 287 --config KEY=VALUE or PATH 288 Overrides a Cargo configuration value. The argument should be in 289 TOML syntax of KEY=VALUE, or provided as a path to an extra 290 configuration file. This flag may be specified multiple times. See 291 the command-line overrides section 292 <https://doc.rust-lang.org/cargo/reference/config.html#command-line-overrides> 293 for more information. 294 295 -C PATH 296 Changes the current working directory before executing any specified 297 operations. This affects things like where cargo looks by default 298 for the project manifest (Cargo.toml), as well as the directories 299 searched for discovering .cargo/config.toml, for example. This 300 option must appear before the command name, for example cargo -C 301 path/to/my-project build. 302 303 This option is only available on the nightly channel 304 <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and 305 requires the -Z unstable-options flag to enable (see #10098 306 <https://github.com/rust-lang/cargo/issues/10098>). 307 308 -h, --help 309 Prints help information. 310 311 -Z flag 312 Unstable (nightly-only) flags to Cargo. Run cargo -Z help for 313 details. 314 315ENVIRONMENT 316 See the reference 317 <https://doc.rust-lang.org/cargo/reference/environment-variables.html> 318 for details on environment variables that Cargo reads. 319 320EXIT STATUS 321 o 0: Cargo succeeded. 322 323 o 101: Cargo failed to complete. 324 325EXAMPLES 326 1. Publish the current package: 327 328 cargo publish 329 330SEE ALSO 331 cargo(1), cargo-package(1), cargo-login(1) 332