Auto merge of #11240 - epage:docs, r=Muscraft

docs(add): Add missing flags to reference

Fixes #11237
This commit is contained in:
bors 2022-10-14 18:41:07 +00:00
commit afadab23a5
4 changed files with 116 additions and 0 deletions

View file

@ -91,6 +91,10 @@ Add as a dependency to the [given target platform](../reference/specifying-depen
{{#options}}
{{#option "`--dry-run`" }}
Don't actually write the manifest
{{/option}}
{{#option "`--rename` _name_" }}
[Rename](../reference/specifying-dependencies.html#renaming-dependencies-in-cargotoml) the dependency.
{{/option}}
@ -132,6 +136,12 @@ which enables all specified features.
{{#options}}
{{> options-manifest-path }}
{{#option "`-p` _spec_" "`--package` _spec_" }}
Add dependencies to only the specified package.
{{/option}}
{{> options-locked }}
{{/options}}
{{> section-options-common }}

View file

@ -79,6 +79,9 @@ OPTIONS
</dl>
Dependency options
--dry-run
Don't actually write the manifest
--rename name
Rename
<https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#renaming-dependencies-in-cargotoml>
@ -137,6 +140,35 @@ OPTIONS
Path to the Cargo.toml file. By default, Cargo searches for the
Cargo.toml file in the current directory or any parent directory.
-p spec, --package spec
Add dependencies to only the specified package.
--frozen, --locked
Either of these flags requires that the Cargo.lock file is
up-to-date. If the lock file is missing, or it needs to be updated,
Cargo will exit with an error. The --frozen flag also prevents Cargo
from attempting to access the network to determine if it is
out-of-date.
These may be used in environments where you want to assert that the
Cargo.lock file is up-to-date (such as a CI build) or want to avoid
network access.
--offline
Prevents Cargo from accessing the network for any reason. Without
this flag, Cargo will stop with an error if it needs to access the
network and the network is not available. With this flag, Cargo will
attempt to proceed without the network if possible.
Beware that this may result in different dependency resolution than
online mode. Cargo will restrict itself to crates that are
downloaded locally, even if there might be a newer version as
indicated in the local copy of the index. See the cargo-fetch(1)
command to download dependencies before going offline.
May also be specified with the net.offline config value
<https://doc.rust-lang.org/cargo/reference/config.html>.
Common Options
+toolchain
If Cargo has been installed with rustup, and the first argument to

View file

@ -97,6 +97,10 @@ which is defined by the <code>registry.default</code> config key which defaults
<dl>
<dt class="option-term" id="option-cargo-add---dry-run"><a class="option-anchor" href="#option-cargo-add---dry-run"></a><code>--dry-run</code></dt>
<dd class="option-desc">Don't actually write the manifest</dd>
<dt class="option-term" id="option-cargo-add---rename"><a class="option-anchor" href="#option-cargo-add---rename"></a><code>--rename</code> <em>name</em></dt>
<dd class="option-desc"><a href="../reference/specifying-dependencies.html#renaming-dependencies-in-cargotoml">Rename</a> the dependency.</dd>
@ -168,6 +172,36 @@ terminal.</li>
<code>Cargo.toml</code> file in the current directory or any parent directory.</dd>
<dt class="option-term" id="option-cargo-add--p"><a class="option-anchor" href="#option-cargo-add--p"></a><code>-p</code> <em>spec</em></dt>
<dt class="option-term" id="option-cargo-add---package"><a class="option-anchor" href="#option-cargo-add---package"></a><code>--package</code> <em>spec</em></dt>
<dd class="option-desc">Add dependencies to only the specified package.</dd>
<dt class="option-term" id="option-cargo-add---frozen"><a class="option-anchor" href="#option-cargo-add---frozen"></a><code>--frozen</code></dt>
<dt class="option-term" id="option-cargo-add---locked"><a class="option-anchor" href="#option-cargo-add---locked"></a><code>--locked</code></dt>
<dd class="option-desc">Either of these flags requires that the <code>Cargo.lock</code> file is
up-to-date. If the lock file is missing, or it needs to be updated, Cargo will
exit with an error. The <code>--frozen</code> flag also prevents Cargo from
attempting to access the network to determine if it is out-of-date.</p>
<p>These may be used in environments where you want to assert that the
<code>Cargo.lock</code> file is up-to-date (such as a CI build) or want to avoid network
access.</dd>
<dt class="option-term" id="option-cargo-add---offline"><a class="option-anchor" href="#option-cargo-add---offline"></a><code>--offline</code></dt>
<dd class="option-desc">Prevents Cargo from accessing the network for any reason. Without this
flag, Cargo will stop with an error if it needs to access the network and
the network is not available. With this flag, Cargo will attempt to
proceed without the network if possible.</p>
<p>Beware that this may result in different dependency resolution than online
mode. Cargo will restrict itself to crates that are downloaded locally, even
if there might be a newer version as indicated in the local copy of the index.
See the <a href="cargo-fetch.html">cargo-fetch(1)</a> command to download dependencies before going
offline.</p>
<p>May also be specified with the <code>net.offline</code> <a href="../reference/config.html">config value</a>.</dd>
</dl>
### Common Options

View file

@ -100,6 +100,11 @@ Add as a dependency to the \fIgiven target platform\fR <https://doc.rust\-lang.o
</dl>
.SS "Dependency options"
.sp
\fB\-\-dry\-run\fR
.RS 4
Don't actually write the manifest
.RE
.sp
\fB\-\-rename\fR \fIname\fR
.RS 4
\fIRename\fR <https://doc.rust\-lang.org/cargo/reference/specifying\-dependencies.html#renaming\-dependencies\-in\-cargotoml> the dependency.
@ -179,6 +184,41 @@ May also be specified with the \fBterm.color\fR
Path to the \fBCargo.toml\fR file. By default, Cargo searches for the
\fBCargo.toml\fR file in the current directory or any parent directory.
.RE
.sp
\fB\-p\fR \fIspec\fR,
\fB\-\-package\fR \fIspec\fR
.RS 4
Add dependencies to only the specified package.
.RE
.sp
\fB\-\-frozen\fR,
\fB\-\-locked\fR
.RS 4
Either of these flags requires that the \fBCargo.lock\fR file is
up\-to\-date. If the lock file is missing, or it needs to be updated, Cargo will
exit with an error. The \fB\-\-frozen\fR flag also prevents Cargo from
attempting to access the network to determine if it is out\-of\-date.
.sp
These may be used in environments where you want to assert that the
\fBCargo.lock\fR file is up\-to\-date (such as a CI build) or want to avoid network
access.
.RE
.sp
\fB\-\-offline\fR
.RS 4
Prevents Cargo from accessing the network for any reason. Without this
flag, Cargo will stop with an error if it needs to access the network and
the network is not available. With this flag, Cargo will attempt to
proceed without the network if possible.
.sp
Beware that this may result in different dependency resolution than online
mode. Cargo will restrict itself to crates that are downloaded locally, even
if there might be a newer version as indicated in the local copy of the index.
See the \fBcargo\-fetch\fR(1) command to download dependencies before going
offline.
.sp
May also be specified with the \fBnet.offline\fR \fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
.RE
.SS "Common Options"
.sp
\fB+\fR\fItoolchain\fR