Skip to content

Commit afadab2

Browse files
committedOct 14, 2022
Auto merge of #11240 - epage:docs, r=Muscraft
docs(add): Add missing flags to reference Fixes #11237
2 parents 2f93984 + 85c8f63 commit afadab2

File tree

4 files changed

+116
-0
lines changed

4 files changed

+116
-0
lines changed
 

‎src/doc/man/cargo-add.md

+10
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ Add as a dependency to the [given target platform](../reference/specifying-depen
9191

9292
{{#options}}
9393

94+
{{#option "`--dry-run`" }}
95+
Don't actually write the manifest
96+
{{/option}}
97+
9498
{{#option "`--rename` _name_" }}
9599
[Rename](../reference/specifying-dependencies.html#renaming-dependencies-in-cargotoml) the dependency.
96100
{{/option}}
@@ -132,6 +136,12 @@ which enables all specified features.
132136

133137
{{#options}}
134138
{{> options-manifest-path }}
139+
140+
{{#option "`-p` _spec_" "`--package` _spec_" }}
141+
Add dependencies to only the specified package.
142+
{{/option}}
143+
144+
{{> options-locked }}
135145
{{/options}}
136146

137147
{{> section-options-common }}

‎src/doc/man/generated_txt/cargo-add.txt

+32
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ OPTIONS
7979
</dl>
8080

8181
Dependency options
82+
--dry-run
83+
Don't actually write the manifest
84+
8285
--rename name
8386
Rename
8487
<https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#renaming-dependencies-in-cargotoml>
@@ -137,6 +140,35 @@ OPTIONS
137140
Path to the Cargo.toml file. By default, Cargo searches for the
138141
Cargo.toml file in the current directory or any parent directory.
139142

143+
-p spec, --package spec
144+
Add dependencies to only the specified package.
145+
146+
--frozen, --locked
147+
Either of these flags requires that the Cargo.lock file is
148+
up-to-date. If the lock file is missing, or it needs to be updated,
149+
Cargo will exit with an error. The --frozen flag also prevents Cargo
150+
from attempting to access the network to determine if it is
151+
out-of-date.
152+
153+
These may be used in environments where you want to assert that the
154+
Cargo.lock file is up-to-date (such as a CI build) or want to avoid
155+
network access.
156+
157+
--offline
158+
Prevents Cargo from accessing the network for any reason. Without
159+
this flag, Cargo will stop with an error if it needs to access the
160+
network and the network is not available. With this flag, Cargo will
161+
attempt to proceed without the network if possible.
162+
163+
Beware that this may result in different dependency resolution than
164+
online mode. Cargo will restrict itself to crates that are
165+
downloaded locally, even if there might be a newer version as
166+
indicated in the local copy of the index. See the cargo-fetch(1)
167+
command to download dependencies before going offline.
168+
169+
May also be specified with the net.offline config value
170+
<https://doc.rust-lang.org/cargo/reference/config.html>.
171+
140172
Common Options
141173
+toolchain
142174
If Cargo has been installed with rustup, and the first argument to

‎src/doc/src/commands/cargo-add.md

+34
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ which is defined by the <code>registry.default</code> config key which defaults
9797

9898
<dl>
9999

100+
<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>
101+
<dd class="option-desc">Don't actually write the manifest</dd>
102+
103+
100104
<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>
101105
<dd class="option-desc"><a href="../reference/specifying-dependencies.html#renaming-dependencies-in-cargotoml">Rename</a> the dependency.</dd>
102106

@@ -168,6 +172,36 @@ terminal.</li>
168172
<code>Cargo.toml</code> file in the current directory or any parent directory.</dd>
169173

170174

175+
176+
<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>
177+
<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>
178+
<dd class="option-desc">Add dependencies to only the specified package.</dd>
179+
180+
181+
<dt class="option-term" id="option-cargo-add---frozen"><a class="option-anchor" href="#option-cargo-add---frozen"></a><code>--frozen</code></dt>
182+
<dt class="option-term" id="option-cargo-add---locked"><a class="option-anchor" href="#option-cargo-add---locked"></a><code>--locked</code></dt>
183+
<dd class="option-desc">Either of these flags requires that the <code>Cargo.lock</code> file is
184+
up-to-date. If the lock file is missing, or it needs to be updated, Cargo will
185+
exit with an error. The <code>--frozen</code> flag also prevents Cargo from
186+
attempting to access the network to determine if it is out-of-date.</p>
187+
<p>These may be used in environments where you want to assert that the
188+
<code>Cargo.lock</code> file is up-to-date (such as a CI build) or want to avoid network
189+
access.</dd>
190+
191+
192+
<dt class="option-term" id="option-cargo-add---offline"><a class="option-anchor" href="#option-cargo-add---offline"></a><code>--offline</code></dt>
193+
<dd class="option-desc">Prevents Cargo from accessing the network for any reason. Without this
194+
flag, Cargo will stop with an error if it needs to access the network and
195+
the network is not available. With this flag, Cargo will attempt to
196+
proceed without the network if possible.</p>
197+
<p>Beware that this may result in different dependency resolution than online
198+
mode. Cargo will restrict itself to crates that are downloaded locally, even
199+
if there might be a newer version as indicated in the local copy of the index.
200+
See the <a href="cargo-fetch.html">cargo-fetch(1)</a> command to download dependencies before going
201+
offline.</p>
202+
<p>May also be specified with the <code>net.offline</code> <a href="../reference/config.html">config value</a>.</dd>
203+
204+
171205
</dl>
172206

173207
### Common Options

‎src/etc/man/cargo-add.1

+40
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ Add as a dependency to the \fIgiven target platform\fR <https://doc.rust\-lang.o
100100
</dl>
101101
.SS "Dependency options"
102102
.sp
103+
\fB\-\-dry\-run\fR
104+
.RS 4
105+
Don't actually write the manifest
106+
.RE
107+
.sp
103108
\fB\-\-rename\fR \fIname\fR
104109
.RS 4
105110
\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
179184
Path to the \fBCargo.toml\fR file. By default, Cargo searches for the
180185
\fBCargo.toml\fR file in the current directory or any parent directory.
181186
.RE
187+
.sp
188+
\fB\-p\fR \fIspec\fR,
189+
\fB\-\-package\fR \fIspec\fR
190+
.RS 4
191+
Add dependencies to only the specified package.
192+
.RE
193+
.sp
194+
\fB\-\-frozen\fR,
195+
\fB\-\-locked\fR
196+
.RS 4
197+
Either of these flags requires that the \fBCargo.lock\fR file is
198+
up\-to\-date. If the lock file is missing, or it needs to be updated, Cargo will
199+
exit with an error. The \fB\-\-frozen\fR flag also prevents Cargo from
200+
attempting to access the network to determine if it is out\-of\-date.
201+
.sp
202+
These may be used in environments where you want to assert that the
203+
\fBCargo.lock\fR file is up\-to\-date (such as a CI build) or want to avoid network
204+
access.
205+
.RE
206+
.sp
207+
\fB\-\-offline\fR
208+
.RS 4
209+
Prevents Cargo from accessing the network for any reason. Without this
210+
flag, Cargo will stop with an error if it needs to access the network and
211+
the network is not available. With this flag, Cargo will attempt to
212+
proceed without the network if possible.
213+
.sp
214+
Beware that this may result in different dependency resolution than online
215+
mode. Cargo will restrict itself to crates that are downloaded locally, even
216+
if there might be a newer version as indicated in the local copy of the index.
217+
See the \fBcargo\-fetch\fR(1) command to download dependencies before going
218+
offline.
219+
.sp
220+
May also be specified with the \fBnet.offline\fR \fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
221+
.RE
182222
.SS "Common Options"
183223
.sp
184224
\fB+\fR\fItoolchain\fR

0 commit comments

Comments
 (0)
Please sign in to comment.