From 85c8f63f2a02ba16fd11e05d77f37b5c6910a606 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 14 Oct 2022 09:24:06 -0500 Subject: [PATCH] docs(add): Add missing flags to reference Fixes #11237 --- src/doc/man/cargo-add.md | 10 +++++++ src/doc/man/generated_txt/cargo-add.txt | 32 ++++++++++++++++++++ src/doc/src/commands/cargo-add.md | 34 +++++++++++++++++++++ src/etc/man/cargo-add.1 | 40 +++++++++++++++++++++++++ 4 files changed, 116 insertions(+) diff --git a/src/doc/man/cargo-add.md b/src/doc/man/cargo-add.md index 10c350089c9..5666a924784 100644 --- a/src/doc/man/cargo-add.md +++ b/src/doc/man/cargo-add.md @@ -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 }} diff --git a/src/doc/man/generated_txt/cargo-add.txt b/src/doc/man/generated_txt/cargo-add.txt index 91c47416bdb..ff3d6a78c01 100644 --- a/src/doc/man/generated_txt/cargo-add.txt +++ b/src/doc/man/generated_txt/cargo-add.txt @@ -79,6 +79,9 @@ OPTIONS Dependency options + --dry-run + Don't actually write the manifest + --rename name Rename @@ -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 + . + Common Options +toolchain If Cargo has been installed with rustup, and the first argument to diff --git a/src/doc/src/commands/cargo-add.md b/src/doc/src/commands/cargo-add.md index a397959816e..baca5ef4c76 100644 --- a/src/doc/src/commands/cargo-add.md +++ b/src/doc/src/commands/cargo-add.md @@ -97,6 +97,10 @@ which is defined by the registry.default config key which defaults
+
--dry-run
+
Don't actually write the manifest
+ +
--rename name
Rename the dependency.
@@ -168,6 +172,36 @@ terminal. 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.

+ +
### Common Options diff --git a/src/etc/man/cargo-add.1 b/src/etc/man/cargo-add.1 index dfcb66dc9a1..75202ae0844 100644 --- a/src/etc/man/cargo-add.1 +++ b/src/etc/man/cargo-add.1 @@ -100,6 +100,11 @@ Add as a dependency to the \fIgiven target platform\fR .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 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 \&. +.RE .SS "Common Options" .sp \fB+\fR\fItoolchain\fR