Jeff Vander Stoep | 956d143 | 2020-09-18 13:46:24 +0200 | [diff] [blame] | 1 | '\" t |
| 2 | .\" Title: cargo-publish |
| 3 | .\" Author: [see the "AUTHOR(S)" section] |
| 4 | .\" Generator: Asciidoctor 2.0.10 |
| 5 | .\" Date: 2019-09-05 |
| 6 | .\" Manual: \ \& |
| 7 | .\" Source: \ \& |
| 8 | .\" Language: English |
| 9 | .\" |
| 10 | .TH "CARGO\-PUBLISH" "1" "2019-09-05" "\ \&" "\ \&" |
| 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" |
| 31 | cargo\-publish \- Upload a package to the registry |
| 32 | .SH "SYNOPSIS" |
| 33 | .sp |
| 34 | \fBcargo publish [\fIOPTIONS\fP]\fP |
| 35 | .SH "DESCRIPTION" |
| 36 | .sp |
| 37 | This command will create a distributable, compressed \fB.crate\fP file with the |
| 38 | source code of the package in the current directory and upload it to a |
| 39 | registry. The default registry is \c |
| 40 | .URL "https://crates.io" "" "." |
| 41 | This performs the |
| 42 | following steps: |
| 43 | .sp |
| 44 | .RS 4 |
| 45 | .ie n \{\ |
| 46 | \h'-04' 1.\h'+01'\c |
| 47 | .\} |
| 48 | .el \{\ |
| 49 | . sp -1 |
| 50 | . IP " 1." 4.2 |
| 51 | .\} |
| 52 | Performs a few checks, including: |
| 53 | .sp |
| 54 | .RS 4 |
| 55 | .ie n \{\ |
| 56 | \h'-04'\(bu\h'+03'\c |
| 57 | .\} |
| 58 | .el \{\ |
| 59 | . sp -1 |
| 60 | . IP \(bu 2.3 |
| 61 | .\} |
| 62 | Checks the \fBpackage.publish\fP key in the manifest for restrictions on which |
| 63 | registries you are allowed to publish to. |
| 64 | .RE |
| 65 | .RE |
| 66 | .sp |
| 67 | .RS 4 |
| 68 | .ie n \{\ |
| 69 | \h'-04' 2.\h'+01'\c |
| 70 | .\} |
| 71 | .el \{\ |
| 72 | . sp -1 |
| 73 | . IP " 2." 4.2 |
| 74 | .\} |
| 75 | Create a \fB.crate\fP file by following the steps in \fBcargo\-package\fP(1). |
| 76 | .RE |
| 77 | .sp |
| 78 | .RS 4 |
| 79 | .ie n \{\ |
| 80 | \h'-04' 3.\h'+01'\c |
| 81 | .\} |
| 82 | .el \{\ |
| 83 | . sp -1 |
| 84 | . IP " 3." 4.2 |
| 85 | .\} |
| 86 | Upload the crate to the registry. Note that the server will perform |
| 87 | additional checks on the crate. |
| 88 | .RE |
| 89 | .sp |
| 90 | This command requires you to be authenticated with either the \fB\-\-token\fP option |
| 91 | or using \fBcargo\-login\fP(1). |
| 92 | .sp |
| 93 | See \c |
| 94 | .URL "https://doc.rust\-lang.org/cargo/reference/publishing.html" "the reference" " " |
| 95 | for more details about |
| 96 | packaging and publishing. |
| 97 | .SH "OPTIONS" |
| 98 | .SS "Publish Options" |
| 99 | .sp |
| 100 | \fB\-\-dry\-run\fP |
| 101 | .RS 4 |
| 102 | Perform all checks without uploading. |
| 103 | .RE |
| 104 | .sp |
| 105 | \fB\-\-token\fP \fITOKEN\fP |
| 106 | .RS 4 |
| 107 | API token to use when authenticating. This overrides the token stored in |
| 108 | the credentials file (which is created by \fBcargo\-login\fP(1)). |
| 109 | .sp |
| 110 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "Cargo config" " " |
| 111 | environment variables can be |
| 112 | used to override the tokens stored in the credentials file. The token for |
| 113 | crates.io may be specified with the \fBCARGO_REGISTRY_TOKEN\fP environment |
| 114 | variable. Tokens for other registries may be specified with environment |
| 115 | variables of the form \fBCARGO_REGISTRIES_NAME_TOKEN\fP where \fBNAME\fP is the name |
| 116 | of the registry in all capital letters. |
| 117 | .RE |
| 118 | .sp |
| 119 | \fB\-\-no\-verify\fP |
| 120 | .RS 4 |
| 121 | Don\(cqt verify the contents by building them. |
| 122 | .RE |
| 123 | .sp |
| 124 | \fB\-\-allow\-dirty\fP |
| 125 | .RS 4 |
| 126 | Allow working directories with uncommitted VCS changes to be packaged. |
| 127 | .RE |
| 128 | .sp |
| 129 | \fB\-\-index\fP \fIINDEX\fP |
| 130 | .RS 4 |
| 131 | The URL of the registry index to use. |
| 132 | .RE |
| 133 | .sp |
| 134 | \fB\-\-registry\fP \fIREGISTRY\fP |
| 135 | .RS 4 |
| 136 | Name of the registry to use. Registry names are defined in \c |
| 137 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "Cargo config files" "." |
| 138 | If not specified, the default registry is used, which is defined by the |
| 139 | \fBregistry.default\fP config key which defaults to \fBcrates\-io\fP. |
| 140 | .RE |
| 141 | .SS "Compilation Options" |
| 142 | .sp |
| 143 | \fB\-\-target\fP \fITRIPLE\fP |
| 144 | .RS 4 |
| 145 | Publish for the given architecture. The default is the host |
| 146 | architecture. The general format of the triple is |
| 147 | \fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fP. Run \fBrustc \-\-print target\-list\fP for a |
| 148 | list of supported targets. |
| 149 | .sp |
| 150 | This may also be specified with the \fBbuild.target\fP |
| 151 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." |
| 152 | .sp |
| 153 | Note that specifying this flag makes Cargo run in a different mode where the |
| 154 | target artifacts are placed in a separate directory. See the |
| 155 | .URL "https://doc.rust\-lang.org/cargo/guide/build\-cache.html" "build cache" " " |
| 156 | documentation for more details. |
| 157 | .RE |
| 158 | .sp |
| 159 | \fB\-\-target\-dir\fP \fIDIRECTORY\fP |
| 160 | .RS 4 |
| 161 | Directory for all generated artifacts and intermediate files. May also be |
| 162 | specified with the \fBCARGO_TARGET_DIR\fP environment variable, or the |
| 163 | \fBbuild.target\-dir\fP \c |
| 164 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." |
| 165 | Defaults |
| 166 | to \fBtarget\fP in the root of the workspace. |
| 167 | .RE |
| 168 | .SS "Feature Selection" |
| 169 | .sp |
| 170 | The feature flags allow you to control the enabled features for the "current" |
| 171 | package. The "current" package is the package in the current directory, or the |
| 172 | one specified in \fB\-\-manifest\-path\fP. If running in the root of a virtual |
| 173 | workspace, then the default features are selected for all workspace members, |
| 174 | or all features if \fB\-\-all\-features\fP is specified. |
| 175 | .sp |
| 176 | When no feature options are given, the \fBdefault\fP feature is activated for |
| 177 | every selected package. |
| 178 | .sp |
| 179 | \fB\-\-features\fP \fIFEATURES\fP |
| 180 | .RS 4 |
| 181 | Space or comma separated list of features to activate. These features only |
| 182 | apply to the current directory\(cqs package. Features of direct dependencies |
| 183 | may be enabled with \fB<dep\-name>/<feature\-name>\fP syntax. This flag may be |
| 184 | specified multiple times, which enables all specified features. |
| 185 | .RE |
| 186 | .sp |
| 187 | \fB\-\-all\-features\fP |
| 188 | .RS 4 |
| 189 | Activate all available features of all selected packages. |
| 190 | .RE |
| 191 | .sp |
| 192 | \fB\-\-no\-default\-features\fP |
| 193 | .RS 4 |
| 194 | Do not activate the \fBdefault\fP feature of the current directory\(cqs |
| 195 | package. |
| 196 | .RE |
| 197 | .SS "Manifest Options" |
| 198 | .sp |
| 199 | \fB\-\-manifest\-path\fP \fIPATH\fP |
| 200 | .RS 4 |
| 201 | Path to the \fBCargo.toml\fP file. By default, Cargo searches for the |
| 202 | \fBCargo.toml\fP file in the current directory or any parent directory. |
| 203 | .RE |
| 204 | .sp |
| 205 | \fB\-\-frozen\fP, \fB\-\-locked\fP |
| 206 | .RS 4 |
| 207 | Either of these flags requires that the \fBCargo.lock\fP file is |
| 208 | up\-to\-date. If the lock file is missing, or it needs to be updated, Cargo will |
| 209 | exit with an error. The \fB\-\-frozen\fP flag also prevents Cargo from |
| 210 | attempting to access the network to determine if it is out\-of\-date. |
| 211 | .sp |
| 212 | These may be used in environments where you want to assert that the |
| 213 | \fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network |
| 214 | access. |
| 215 | .RE |
| 216 | .sp |
| 217 | \fB\-\-offline\fP |
| 218 | .RS 4 |
| 219 | Prevents Cargo from accessing the network for any reason. Without this |
| 220 | flag, Cargo will stop with an error if it needs to access the network and |
| 221 | the network is not available. With this flag, Cargo will attempt to |
| 222 | proceed without the network if possible. |
| 223 | .sp |
| 224 | Beware that this may result in different dependency resolution than online |
| 225 | mode. Cargo will restrict itself to crates that are downloaded locally, even |
| 226 | if there might be a newer version as indicated in the local copy of the index. |
| 227 | See the \fBcargo\-fetch\fP(1) command to download dependencies before going |
| 228 | offline. |
| 229 | .sp |
| 230 | May also be specified with the \fBnet.offline\fP \c |
| 231 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." |
| 232 | .RE |
| 233 | .SS "Miscellaneous Options" |
| 234 | .sp |
| 235 | \fB\-j\fP \fIN\fP, \fB\-\-jobs\fP \fIN\fP |
| 236 | .RS 4 |
| 237 | Number of parallel jobs to run. May also be specified with the |
| 238 | \fBbuild.jobs\fP \c |
| 239 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." |
| 240 | Defaults to |
| 241 | the number of CPUs. |
| 242 | .RE |
| 243 | .SS "Display Options" |
| 244 | .sp |
| 245 | \fB\-v\fP, \fB\-\-verbose\fP |
| 246 | .RS 4 |
| 247 | Use verbose output. May be specified twice for "very verbose" output which |
| 248 | includes extra output such as dependency warnings and build script output. |
| 249 | May also be specified with the \fBterm.verbose\fP |
| 250 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." |
| 251 | .RE |
| 252 | .sp |
| 253 | \fB\-q\fP, \fB\-\-quiet\fP |
| 254 | .RS 4 |
| 255 | No output printed to stdout. |
| 256 | .RE |
| 257 | .sp |
| 258 | \fB\-\-color\fP \fIWHEN\fP |
| 259 | .RS 4 |
| 260 | Control when colored output is used. Valid values: |
| 261 | .sp |
| 262 | .RS 4 |
| 263 | .ie n \{\ |
| 264 | \h'-04'\(bu\h'+03'\c |
| 265 | .\} |
| 266 | .el \{\ |
| 267 | . sp -1 |
| 268 | . IP \(bu 2.3 |
| 269 | .\} |
| 270 | \fBauto\fP (default): Automatically detect if color support is available on the |
| 271 | terminal. |
| 272 | .RE |
| 273 | .sp |
| 274 | .RS 4 |
| 275 | .ie n \{\ |
| 276 | \h'-04'\(bu\h'+03'\c |
| 277 | .\} |
| 278 | .el \{\ |
| 279 | . sp -1 |
| 280 | . IP \(bu 2.3 |
| 281 | .\} |
| 282 | \fBalways\fP: Always display colors. |
| 283 | .RE |
| 284 | .sp |
| 285 | .RS 4 |
| 286 | .ie n \{\ |
| 287 | \h'-04'\(bu\h'+03'\c |
| 288 | .\} |
| 289 | .el \{\ |
| 290 | . sp -1 |
| 291 | . IP \(bu 2.3 |
| 292 | .\} |
| 293 | \fBnever\fP: Never display colors. |
| 294 | .RE |
| 295 | .sp |
| 296 | May also be specified with the \fBterm.color\fP |
| 297 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." |
| 298 | .RE |
| 299 | .SS "Common Options" |
| 300 | .sp |
| 301 | \fB+TOOLCHAIN\fP |
| 302 | .RS 4 |
| 303 | If Cargo has been installed with rustup, and the first argument to \fBcargo\fP |
| 304 | begins with \fB+\fP, it will be interpreted as a rustup toolchain name (such |
| 305 | as \fB+stable\fP or \fB+nightly\fP). |
| 306 | See the \c |
| 307 | .URL "https://github.com/rust\-lang/rustup/" "rustup documentation" |
| 308 | for more information about how toolchain overrides work. |
| 309 | .RE |
| 310 | .sp |
| 311 | \fB\-h\fP, \fB\-\-help\fP |
| 312 | .RS 4 |
| 313 | Prints help information. |
| 314 | .RE |
| 315 | .sp |
| 316 | \fB\-Z\fP \fIFLAG\fP... |
| 317 | .RS 4 |
| 318 | Unstable (nightly\-only) flags to Cargo. Run \fBcargo \-Z help\fP for |
| 319 | details. |
| 320 | .RE |
| 321 | .SH "ENVIRONMENT" |
| 322 | .sp |
| 323 | See \c |
| 324 | .URL "https://doc.rust\-lang.org/cargo/reference/environment\-variables.html" "the reference" " " |
| 325 | for |
| 326 | details on environment variables that Cargo reads. |
| 327 | .SH "EXIT STATUS" |
| 328 | .sp |
| 329 | 0 |
| 330 | .RS 4 |
| 331 | Cargo succeeded. |
| 332 | .RE |
| 333 | .sp |
| 334 | 101 |
| 335 | .RS 4 |
| 336 | Cargo failed to complete. |
| 337 | .RE |
| 338 | .SH "EXAMPLES" |
| 339 | .sp |
| 340 | .RS 4 |
| 341 | .ie n \{\ |
| 342 | \h'-04' 1.\h'+01'\c |
| 343 | .\} |
| 344 | .el \{\ |
| 345 | . sp -1 |
| 346 | . IP " 1." 4.2 |
| 347 | .\} |
| 348 | Publish the current package: |
| 349 | .sp |
| 350 | .if n .RS 4 |
| 351 | .nf |
| 352 | cargo publish |
| 353 | .fi |
| 354 | .if n .RE |
| 355 | .RE |
| 356 | .SH "SEE ALSO" |
| 357 | .sp |
| 358 | \fBcargo\fP(1), \fBcargo\-package\fP(1), \fBcargo\-login\fP(1) |