Skip to content

Commit 88b4b3b

Browse files
committed
Auto merge of #14339 - weihanglo:mdman, r=epage
fix: also build manpage for cargo.md
2 parents 11dccd1 + 96767be commit 88b4b3b

File tree

5 files changed

+73
-31
lines changed

5 files changed

+73
-31
lines changed

crates/xtask-build-man/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ fn build_mdman() -> io::Result<()> {
4545
/// saved in the src/doc/src/commands/ directory. These are included in the
4646
/// Cargo book, which is converted to HTML by mdbook.
4747
fn build_cargo() -> io::Result<()> {
48-
// Find all `src/doc/man/cargo-*.md`
48+
// Find all `src/doc/man/cargo*.md`
4949
let src_paths = {
5050
let mut src_paths = Vec::new();
5151
for entry in fs::read_dir("src/doc/man")? {
5252
let entry = entry?;
5353
let file_name = entry.file_name();
5454
let file_name = file_name.to_str().unwrap();
55-
if file_name.starts_with("cargo-") && file_name.ends_with(".md") {
55+
if file_name.starts_with("cargo") && file_name.ends_with(".md") {
5656
src_paths.push(entry.path());
5757
}
5858
}

src/doc/man/cargo.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ available at <https://rust-lang.org>.
5656

5757
### Manifest Commands
5858

59+
{{man "cargo-add" 1}}\
60+
&nbsp;&nbsp;&nbsp;&nbsp;Add dependencies to a `Cargo.toml` manifest file.
61+
5962
{{man "cargo-generate-lockfile" 1}}\
6063
&nbsp;&nbsp;&nbsp;&nbsp;Generate `Cargo.lock` for a project.
6164

@@ -68,6 +71,9 @@ available at <https://rust-lang.org>.
6871
{{man "cargo-pkgid" 1}}\
6972
&nbsp;&nbsp;&nbsp;&nbsp;Print a fully qualified package specification.
7073

74+
{{man "cargo-remove" 1}}\
75+
&nbsp;&nbsp;&nbsp;&nbsp;Remove dependencies from a `Cargo.toml` manifest file.
76+
7177
{{man "cargo-tree" 1}}\
7278
&nbsp;&nbsp;&nbsp;&nbsp;Display a tree visualization of a dependency graph.
7379

src/doc/man/generated_txt/cargo.txt

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ COMMANDS
5050
    Execute unit and integration tests of a package.
5151

5252
Manifest Commands
53+
cargo-add(1)
54+
    Add dependencies to a Cargo.toml manifest file.
55+
5356
cargo-generate-lockfile(1)
5457
    Generate Cargo.lock for a project.
5558

@@ -63,6 +66,9 @@ COMMANDS
6366
cargo-pkgid(1)
6467
    Print a fully qualified package specification.
6568

69+
cargo-remove(1)
70+
    Remove dependencies from a Cargo.toml manifest file.
71+
6672
cargo-tree(1)
6773
    Display a tree visualization of a dependency graph.
6874

@@ -158,16 +164,19 @@ OPTIONS
158164
<https://doc.rust-lang.org/cargo/reference/config.html>.
159165

160166
Manifest Options
161-
--frozen, --locked
162-
Either of these flags requires that the Cargo.lock file is
163-
up-to-date. If the lock file is missing, or it needs to be updated,
164-
Cargo will exit with an error. The --frozen flag also prevents Cargo
165-
from attempting to access the network to determine if it is
166-
out-of-date.
167+
--locked
168+
Asserts that the exact same dependencies and versions are used as
169+
when the existing Cargo.lock file was originally generated. Cargo
170+
will exit with an error when either of the following scenarios
171+
arises:
172+
173+
o The lock file is missing.
167174

168-
These may be used in environments where you want to assert that the
169-
Cargo.lock file is up-to-date (such as a CI build) or want to avoid
170-
network access.
175+
o Cargo attempted to change the lock file due to a different
176+
dependency resolution.
177+
178+
It may be used in environments where deterministic builds are
179+
desired, such as in CI pipelines.
171180

172181
--offline
173182
Prevents Cargo from accessing the network for any reason. Without
@@ -184,6 +193,9 @@ OPTIONS
184193
May also be specified with the net.offline config value
185194
<https://doc.rust-lang.org/cargo/reference/config.html>.
186195

196+
--frozen
197+
Equivalent to specifying both --locked and --offline.
198+
187199
Common Options
188200
+toolchain
189201
If Cargo has been installed with rustup, and the first argument to

src/doc/src/commands/cargo.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ available at <https://rust-lang.org>.
5656

5757
### Manifest Commands
5858

59+
[cargo-add(1)](cargo-add.html)\
60+
&nbsp;&nbsp;&nbsp;&nbsp;Add dependencies to a `Cargo.toml` manifest file.
61+
5962
[cargo-generate-lockfile(1)](cargo-generate-lockfile.html)\
6063
&nbsp;&nbsp;&nbsp;&nbsp;Generate `Cargo.lock` for a project.
6164

@@ -68,6 +71,9 @@ available at <https://rust-lang.org>.
6871
[cargo-pkgid(1)](cargo-pkgid.html)\
6972
&nbsp;&nbsp;&nbsp;&nbsp;Print a fully qualified package specification.
7073

74+
[cargo-remove(1)](cargo-remove.html)\
75+
&nbsp;&nbsp;&nbsp;&nbsp;Remove dependencies from a `Cargo.toml` manifest file.
76+
7177
[cargo-tree(1)](cargo-tree.html)\
7278
&nbsp;&nbsp;&nbsp;&nbsp;Display a tree visualization of a dependency graph.
7379

@@ -180,21 +186,21 @@ terminal.</li>
180186
<a href="../reference/config.html">config value</a>.</dd>
181187

182188

183-
184189
</dl>
185190

186191
### Manifest Options
187192

188193
<dl>
189-
<dt class="option-term" id="option-cargo---frozen"><a class="option-anchor" href="#option-cargo---frozen"></a><code>--frozen</code></dt>
190194
<dt class="option-term" id="option-cargo---locked"><a class="option-anchor" href="#option-cargo---locked"></a><code>--locked</code></dt>
191-
<dd class="option-desc">Either of these flags requires that the <code>Cargo.lock</code> file is
192-
up-to-date. If the lock file is missing, or it needs to be updated, Cargo will
193-
exit with an error. The <code>--frozen</code> flag also prevents Cargo from
194-
attempting to access the network to determine if it is out-of-date.</p>
195-
<p>These may be used in environments where you want to assert that the
196-
<code>Cargo.lock</code> file is up-to-date (such as a CI build) or want to avoid network
197-
access.</dd>
195+
<dd class="option-desc">Asserts that the exact same dependencies and versions are used as when the
196+
existing <code>Cargo.lock</code> file was originally generated. Cargo will exit with an
197+
error when either of the following scenarios arises:</p>
198+
<ul>
199+
<li>The lock file is missing.</li>
200+
<li>Cargo attempted to change the lock file due to a different dependency resolution.</li>
201+
</ul>
202+
<p>It may be used in environments where deterministic builds are desired,
203+
such as in CI pipelines.</dd>
198204

199205

200206
<dt class="option-term" id="option-cargo---offline"><a class="option-anchor" href="#option-cargo---offline"></a><code>--offline</code></dt>
@@ -210,6 +216,9 @@ offline.</p>
210216
<p>May also be specified with the <code>net.offline</code> <a href="../reference/config.html">config value</a>.</dd>
211217

212218

219+
<dt class="option-term" id="option-cargo---frozen"><a class="option-anchor" href="#option-cargo---frozen"></a><code>--frozen</code></dt>
220+
<dd class="option-desc">Equivalent to specifying both <code>--locked</code> and <code>--offline</code>.</dd>
221+
213222
</dl>
214223

215224
### Common Options
@@ -252,19 +261,16 @@ requires the <code>-Z unstable-options</code> flag to enable (see
252261

253262
</dl>
254263

255-
256264
## ENVIRONMENT
257265

258266
See [the reference](../reference/environment-variables.html) for
259267
details on environment variables that Cargo reads.
260268

261-
262269
## EXIT STATUS
263270

264271
* `0`: Cargo succeeded.
265272
* `101`: Cargo failed to complete.
266273

267-
268274
## FILES
269275

270276
`~/.cargo/`\

src/etc/man/cargo.1

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ available at <https://rust\-lang.org>\&.
6464
.br
6565
\ \ \ \ Execute unit and integration tests of a package.
6666
.SS "Manifest Commands"
67+
\fBcargo\-add\fR(1)
68+
.br
69+
\ \ \ \ Add dependencies to a \fBCargo.toml\fR manifest file.
70+
.sp
6771
\fBcargo\-generate\-lockfile\fR(1)
6872
.br
6973
\ \ \ \ Generate \fBCargo.lock\fR for a project.
@@ -80,6 +84,10 @@ available at <https://rust\-lang.org>\&.
8084
.br
8185
\ \ \ \ Print a fully qualified package specification.
8286
.sp
87+
\fBcargo\-remove\fR(1)
88+
.br
89+
\ \ \ \ Remove dependencies from a \fBCargo.toml\fR manifest file.
90+
.sp
8391
\fBcargo\-tree\fR(1)
8492
.br
8593
\ \ \ \ Display a tree visualization of a dependency graph.
@@ -209,17 +217,22 @@ May also be specified with the \fBterm.color\fR
209217
.RE
210218
.SS "Manifest Options"
211219
.sp
212-
\fB\-\-frozen\fR,
213220
\fB\-\-locked\fR
214221
.RS 4
215-
Either of these flags requires that the \fBCargo.lock\fR file is
216-
up\-to\-date. If the lock file is missing, or it needs to be updated, Cargo will
217-
exit with an error. The \fB\-\-frozen\fR flag also prevents Cargo from
218-
attempting to access the network to determine if it is out\-of\-date.
222+
Asserts that the exact same dependencies and versions are used as when the
223+
existing \fBCargo.lock\fR file was originally generated. Cargo will exit with an
224+
error when either of the following scenarios arises:
219225
.sp
220-
These may be used in environments where you want to assert that the
221-
\fBCargo.lock\fR file is up\-to\-date (such as a CI build) or want to avoid network
222-
access.
226+
.RS 4
227+
\h'-04'\(bu\h'+02'The lock file is missing.
228+
.RE
229+
.sp
230+
.RS 4
231+
\h'-04'\(bu\h'+02'Cargo attempted to change the lock file due to a different dependency resolution.
232+
.RE
233+
.sp
234+
It may be used in environments where deterministic builds are desired,
235+
such as in CI pipelines.
223236
.RE
224237
.sp
225238
\fB\-\-offline\fR
@@ -237,6 +250,11 @@ offline.
237250
.sp
238251
May also be specified with the \fBnet.offline\fR \fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
239252
.RE
253+
.sp
254+
\fB\-\-frozen\fR
255+
.RS 4
256+
Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&.
257+
.RE
240258
.SS "Common Options"
241259
.sp
242260
\fB+\fR\fItoolchain\fR

0 commit comments

Comments
 (0)