fork/cargo

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

borsAuto merge of #12490 - amosbird:cargo-yank-doc-fix1, r=weihanglo006747657

0.87.0
8.5 KiB191 linesraw
1CARGO-YANK(1)
2
3NAME
4       cargo-yank — Remove a pushed crate from the index
5
6SYNOPSIS
7       cargo yank [options] crate@version
8       cargo yank [options] --version version [crate]
9
10DESCRIPTION
11       The yank command removes a previously published crate’s version from
12       the server’s index. This command does not delete any data, and the
13       crate will still be available for download via the registry’s download
14       link.
15
16       Cargo will not use a yanked version for any new project or checkout
17       without a pre-existing lockfile, and will generate an error if there are
18       no longer any compatible versions for your crate.
19
20       This command requires you to be authenticated with either the --token
21       option or using cargo-login(1).
22
23       If the crate name is not specified, it will use the package name from
24       the current directory.
25
26   How yank works
27       For example, the foo crate published version 1.5.0 and another crate bar
28       declared a dependency on version foo = "1.5". Now foo releases a new,
29       but not semver compatible, version 2.0.0, and finds a critical issue
30       with 1.5.0. If 1.5.0 is yanked, no new project or checkout without an
31       existing lockfile will be able to use crate bar as it relies on 1.5.
32
33       In this case, the maintainers of foo should first publish a semver
34       compatible version such as 1.5.1 prior to yanking 1.5.0 so that bar and
35       all projects that depend on bar will continue to work.
36
37       As another example, consider a crate bar with published versions 1.5.0,
38       1.5.1, 1.5.2, 2.0.0 and 3.0.0. The following table identifies the
39       versions cargo could use in the absence of a lockfile for different
40       SemVer requirements, following a given release being yanked:
41
42       +------------------------+----------------------+----------+----------+
43       | Yanked Version /       | bar = "1.5.0"        | bar =    | bar =    |
44       | SemVer requirement     |                      | "=1.5.0" | "2.0.0"  |
45       +------------------------+----------------------+----------+----------+
46       | 1.5.0                  | Use either 1.5.1 or  | Return   | Use      |
47       |                        | 1.5.2                | Error    | 2.0.0    |
48       +------------------------+----------------------+----------+----------+
49       | 1.5.1                  | Use either 1.5.0 or  | Use      | Use      |
50       |                        | 1.5.2                | 1.5.0    | 2.0.0    |
51       +------------------------+----------------------+----------+----------+
52       | 2.0.0                  | Use either 1.5.0,    | Use      | Return   |
53       |                        | 1.5.1 or 1.5.2       | 1.5.0    | Error    |
54       +------------------------+----------------------+----------+----------+
55
56   When to yank
57       Crates should only be yanked in exceptional circumstances, for example,
58       an accidental publish, an unintentional SemVer breakages, or a
59       significantly broken and unusable crate. In the case of security
60       vulnerabilities, RustSec <https://rustsec.org/> is typically a less
61       disruptive mechanism to inform users and encourage them to upgrade, and
62       avoids the possibility of significant downstream disruption irrespective
63       of susceptibility to the vulnerability in question.
64
65       A common workflow is to yank a crate having already published a semver
66       compatible version, to reduce the probability of preventing dependent
67       crates from compiling.
68
69       When addressing copyright, licensing, or personal data issues with a
70       published crate, simply yanking it may not suffice. In such cases,
71       contact the maintainers of the registry you used. For crates.io, refer
72       to their policies <https://crates.io/policies> and contact them at
73       <help@crates.io>.
74
75       If credentials have been leaked, the recommended course of action is to
76       revoke them immediately. Once a crate has been published, it is
77       impossible to determine if the leaked credentials have been copied.
78       Yanking the crate only prevents new users from downloading it, but
79       cannot stop those who have already downloaded it from keeping or even
80       spreading the leaked credentials.
81
82OPTIONS
83   Yank Options
84       --vers version, --version version
85           The version to yank or un-yank.
86
87       --undo
88           Undo a yank, putting a version back into the index.
89
90       --token token
91           API token to use when authenticating. This overrides the token
92           stored in the credentials file (which is created by cargo-login(1)).
93
94           Cargo config <https://doc.rust-lang.org/cargo/reference/config.html>
95           environment variables can be used to override the tokens stored in
96           the credentials file. The token for crates.io may be specified with
97           the CARGO_REGISTRY_TOKEN environment variable. Tokens for other
98           registries may be specified with environment variables of the form
99           CARGO_REGISTRIES_NAME_TOKEN where NAME is the name of the registry
100           in all capital letters.
101
102       --index index
103           The URL of the registry index to use.
104
105       --registry registry
106           Name of the registry to use. Registry names are defined in Cargo
107           config files
108           <https://doc.rust-lang.org/cargo/reference/config.html>. If not
109           specified, the default registry is used, which is defined by the
110           registry.default config key which defaults to crates-io.
111
112   Display Options
113       -v, --verbose
114           Use verbose output. May be specified twice for “very verbose”
115           output which includes extra output such as dependency warnings and
116           build script output. May also be specified with the term.verbose
117           config value
118           <https://doc.rust-lang.org/cargo/reference/config.html>.
119
120       -q, --quiet
121           Do not print cargo log messages. May also be specified with the
122           term.quiet config value
123           <https://doc.rust-lang.org/cargo/reference/config.html>.
124
125       --color when
126           Control when colored output is used. Valid values:
127
128           o  auto (default): Automatically detect if color support is
129              available on the terminal.
130
131           o  always: Always display colors.
132
133           o  never: Never display colors.
134
135           May also be specified with the term.color config value
136           <https://doc.rust-lang.org/cargo/reference/config.html>.
137
138   Common Options
139       +toolchain
140           If Cargo has been installed with rustup, and the first argument to
141           cargo begins with +, it will be interpreted as a rustup toolchain
142           name (such as +stable or +nightly). See the rustup documentation
143           <https://rust-lang.github.io/rustup/overrides.html> for more
144           information about how toolchain overrides work.
145
146       --config KEY=VALUE or PATH
147           Overrides a Cargo configuration value. The argument should be in
148           TOML syntax of KEY=VALUE, or provided as a path to an extra
149           configuration file. This flag may be specified multiple times. See
150           the command-line overrides section
151           <https://doc.rust-lang.org/cargo/reference/config.html#command-line-overrides>
152           for more information.
153
154       -C PATH
155           Changes the current working directory before executing any specified
156           operations. This affects things like where cargo looks by default
157           for the project manifest (Cargo.toml), as well as the directories
158           searched for discovering .cargo/config.toml, for example. This
159           option must appear before the command name, for example cargo -C
160           path/to/my-project build.
161
162           This option is only available on the nightly channel
163           <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
164           requires the -Z unstable-options flag to enable (see #10098
165           <https://github.com/rust-lang/cargo/issues/10098>).
166
167       -h, --help
168           Prints help information.
169
170       -Z flag
171           Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
172           details.
173
174ENVIRONMENT
175       See the reference
176       <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
177       for details on environment variables that Cargo reads.
178
179EXIT STATUS
180       o  0: Cargo succeeded.
181
182       o  101: Cargo failed to complete.
183
184EXAMPLES
185       1. Yank a crate from the index:
186
187              cargo yank foo@1.0.7
188
189SEE ALSO
190       cargo(1), cargo-login(1), cargo-publish(1)
191