fork/cargo

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

Eric HussFix man page with malformed `{{#options}}` block (#15191)ad740fd22

0.90.0
14.4 KiB329 linesraw
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
102           Selecting more than one package with this option is unstable and
103           available only on the nightly channel
104           <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
105           requires the -Z package-workspace flag to enable. See
106           <https://github.com/rust-lang/cargo/issues/10948> for more
107           information.
108
109       --workspace
110           Publish all members in the workspace.
111
112           This option is unstable and available only on the nightly channel
113           <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
114           requires the -Z package-workspace flag to enable. See
115           <https://github.com/rust-lang/cargo/issues/10948> for more
116           information.
117
118       --exclude SPEC…
119           Exclude the specified packages. Must be used in conjunction with the
120           --workspace flag. This flag may be specified multiple times and
121           supports common Unix glob patterns like *, ? and []. However, to
122           avoid your shell accidentally expanding glob patterns before Cargo
123           handles them, you must use single quotes or double quotes around
124           each pattern.
125
126           This option is unstable and available only on the nightly channel
127           <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
128           requires the -Z package-workspace flag to enable. See
129           <https://github.com/rust-lang/cargo/issues/10948> for more
130           information.
131
132   Compilation Options
133       --target triple
134           Publish for the given architecture. The default is the host
135           architecture. The general format of the triple is
136           <arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
137           a list of supported targets. This flag may be specified multiple
138           times.
139
140           This may also be specified with the build.target config value
141           <https://doc.rust-lang.org/cargo/reference/config.html>.
142
143           Note that specifying this flag makes Cargo run in a different mode
144           where the target artifacts are placed in a separate directory. See
145           the build cache
146           <https://doc.rust-lang.org/cargo/reference/build-cache.html>
147           documentation for more details.
148
149       --target-dir directory
150           Directory for all generated artifacts and intermediate files. May
151           also be specified with the CARGO_TARGET_DIR environment variable, or
152           the build.target-dir config value
153           <https://doc.rust-lang.org/cargo/reference/config.html>. Defaults to
154           target in the root of the workspace.
155
156   Feature Selection
157       The feature flags allow you to control which features are enabled. When
158       no feature options are given, the default feature is activated for every
159       selected package.
160
161       See the features documentation
162       <https://doc.rust-lang.org/cargo/reference/features.html#command-line-feature-options>
163       for more details.
164
165       -F features, --features features
166           Space or comma separated list of features to activate. Features of
167           workspace members may be enabled with package-name/feature-name
168           syntax. This flag may be specified multiple times, which enables all
169           specified features.
170
171       --all-features
172           Activate all available features of all selected packages.
173
174       --no-default-features
175           Do not activate the default feature of the selected packages.
176
177   Manifest Options
178       --manifest-path path
179           Path to the Cargo.toml file. By default, Cargo searches for the
180           Cargo.toml file in the current directory or any parent directory.
181
182       --locked
183           Asserts that the exact same dependencies and versions are used as
184           when the existing Cargo.lock file was originally generated. Cargo
185           will exit with an error when either of the following scenarios
186           arises:
187
188           o  The lock file is missing.
189
190           o  Cargo attempted to change the lock file due to a different
191              dependency resolution.
192
193           It may be used in environments where deterministic builds are
194           desired, such as in CI pipelines.
195
196       --offline
197           Prevents Cargo from accessing the network for any reason. Without
198           this flag, Cargo will stop with an error if it needs to access the
199           network and the network is not available. With this flag, Cargo will
200           attempt to proceed without the network if possible.
201
202           Beware that this may result in different dependency resolution than
203           online mode. Cargo will restrict itself to crates that are
204           downloaded locally, even if there might be a newer version as
205           indicated in the local copy of the index. See the cargo-fetch(1)
206           command to download dependencies before going offline.
207
208           May also be specified with the net.offline config value
209           <https://doc.rust-lang.org/cargo/reference/config.html>.
210
211       --frozen
212           Equivalent to specifying both --locked and --offline.
213
214       --lockfile-path PATH
215           Changes the path of the lockfile from the default
216           (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock
217           (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that
218           providing --lockfile-path will ignore existing lockfile at the
219           default path, and instead will either use the lockfile from PATH, or
220           write a new lockfile into the provided PATH if it doesn’t exist.
221           This flag can be used to run most commands in read-only directories,
222           writing lockfile into the provided PATH.
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 #14421
227           <https://github.com/rust-lang/cargo/issues/14421>).
228
229   Miscellaneous Options
230       -j N, --jobs N
231           Number of parallel jobs to run. May also be specified with the
232           build.jobs config value
233           <https://doc.rust-lang.org/cargo/reference/config.html>. Defaults to
234           the number of logical CPUs. If negative, it sets the maximum number
235           of parallel jobs to the number of logical CPUs plus provided value.
236           If a string default is provided, it sets the value back to defaults.
237           Should not be 0.
238
239       --keep-going
240           Build as many crates in the dependency graph as possible, rather
241           than aborting the build on the first one that fails to build.
242
243           For example if the current package depends on dependencies fails and
244           works, one of which fails to build, cargo publish -j1 may or may not
245           build the one that succeeds (depending on which one of the two
246           builds Cargo picked to run first), whereas cargo publish -j1
247           --keep-going would definitely run both builds, even if the one run
248           first fails.
249
250   Display Options
251       -v, --verbose
252           Use verbose output. May be specified twice for “very verbose”
253           output which includes extra output such as dependency warnings and
254           build script output. May also be specified with the term.verbose
255           config value
256           <https://doc.rust-lang.org/cargo/reference/config.html>.
257
258       -q, --quiet
259           Do not print cargo log messages. May also be specified with the
260           term.quiet config value
261           <https://doc.rust-lang.org/cargo/reference/config.html>.
262
263       --color when
264           Control when colored output is used. Valid values:
265
266           o  auto (default): Automatically detect if color support is
267              available on the terminal.
268
269           o  always: Always display colors.
270
271           o  never: Never display colors.
272
273           May also be specified with the term.color config value
274           <https://doc.rust-lang.org/cargo/reference/config.html>.
275
276   Common Options
277       +toolchain
278           If Cargo has been installed with rustup, and the first argument to
279           cargo begins with +, it will be interpreted as a rustup toolchain
280           name (such as +stable or +nightly). See the rustup documentation
281           <https://rust-lang.github.io/rustup/overrides.html> for more
282           information about how toolchain overrides work.
283
284       --config KEY=VALUE or PATH
285           Overrides a Cargo configuration value. The argument should be in
286           TOML syntax of KEY=VALUE, or provided as a path to an extra
287           configuration file. This flag may be specified multiple times. See
288           the command-line overrides section
289           <https://doc.rust-lang.org/cargo/reference/config.html#command-line-overrides>
290           for more information.
291
292       -C PATH
293           Changes the current working directory before executing any specified
294           operations. This affects things like where cargo looks by default
295           for the project manifest (Cargo.toml), as well as the directories
296           searched for discovering .cargo/config.toml, for example. This
297           option must appear before the command name, for example cargo -C
298           path/to/my-project build.
299
300           This option is only available on the nightly channel
301           <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
302           requires the -Z unstable-options flag to enable (see #10098
303           <https://github.com/rust-lang/cargo/issues/10098>).
304
305       -h, --help
306           Prints help information.
307
308       -Z flag
309           Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
310           details.
311
312ENVIRONMENT
313       See the reference
314       <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
315       for details on environment variables that Cargo reads.
316
317EXIT STATUS
318       o  0: Cargo succeeded.
319
320       o  101: Cargo failed to complete.
321
322EXAMPLES
323       1. Publish the current package:
324
325              cargo publish
326
327SEE ALSO
328       cargo(1), cargo-package(1), cargo-login(1)
329