Skip to content

Commit

Permalink
fix: also build manpage for cargo.md
Browse files Browse the repository at this point in the history
  • Loading branch information
weihanglo committed Aug 1, 2024
1 parent 257b72b commit d1e72bc
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 31 deletions.
4 changes: 2 additions & 2 deletions crates/xtask-build-man/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ fn build_mdman() -> io::Result<()> {
/// saved in the src/doc/src/commands/ directory. These are included in the
/// Cargo book, which is converted to HTML by mdbook.
fn build_cargo() -> io::Result<()> {
// Find all `src/doc/man/cargo-*.md`
// Find all `src/doc/man/cargo*.md`
let src_paths = {
let mut src_paths = Vec::new();
for entry in fs::read_dir("src/doc/man")? {
let entry = entry?;
let file_name = entry.file_name();
let file_name = file_name.to_str().unwrap();
if file_name.starts_with("cargo-") && file_name.ends_with(".md") {
if file_name.starts_with("cargo") && file_name.ends_with(".md") {
src_paths.push(entry.path());
}
}
Expand Down
24 changes: 15 additions & 9 deletions src/doc/man/generated_txt/cargo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,19 @@ OPTIONS
<https://doc.rust-lang.org/cargo/reference/config.html>.

Manifest Options
--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.
--locked
Asserts that the exact same dependencies and versions are used as
when the existing Cargo.lock file was originally generated. Cargo
will exit with an error when either of the following scenarios
arises:

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.
o The lock file is missing.

o Cargo attempted to change the lock file due to a different
dependency resolution.

It may be used in environments where deterministic builds are
desired, such as in CI pipelines.

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

--frozen
Equivalent to specifying both --locked and --offline.

Common Options
+toolchain
If Cargo has been installed with rustup, and the first argument to
Expand Down
24 changes: 12 additions & 12 deletions src/doc/src/commands/cargo.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,21 +180,21 @@ terminal.</li>
<a href="../reference/config.html">config value</a>.</dd>



</dl>

### Manifest Options

<dl>
<dt class="option-term" id="option-cargo---frozen"><a class="option-anchor" href="#option-cargo---frozen"></a><code>--frozen</code></dt>
<dt class="option-term" id="option-cargo---locked"><a class="option-anchor" href="#option-cargo---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>
<dd class="option-desc">Asserts that the exact same dependencies and versions are used as when the
existing <code>Cargo.lock</code> file was originally generated. Cargo will exit with an
error when either of the following scenarios arises:</p>
<ul>
<li>The lock file is missing.</li>
<li>Cargo attempted to change the lock file due to a different dependency resolution.</li>
</ul>
<p>It may be used in environments where deterministic builds are desired,
such as in CI pipelines.</dd>


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


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

</dl>

### Common Options
Expand Down Expand Up @@ -252,19 +255,16 @@ requires the <code>-Z unstable-options</code> flag to enable (see

</dl>


## ENVIRONMENT

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


## EXIT STATUS

* `0`: Cargo succeeded.
* `101`: Cargo failed to complete.


## FILES

`~/.cargo/`\
Expand Down
26 changes: 18 additions & 8 deletions src/etc/man/cargo.1
Original file line number Diff line number Diff line change
Expand Up @@ -209,17 +209,22 @@ May also be specified with the \fBterm.color\fR
.RE
.SS "Manifest Options"
.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.
Asserts that the exact same dependencies and versions are used as when the
existing \fBCargo.lock\fR file was originally generated. Cargo will exit with an
error when either of the following scenarios arises:
.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.
.RS 4
\h'-04'\(bu\h'+02'The lock file is missing.
.RE
.sp
.RS 4
\h'-04'\(bu\h'+02'Cargo attempted to change the lock file due to a different dependency resolution.
.RE
.sp
It may be used in environments where deterministic builds are desired,
such as in CI pipelines.
.RE
.sp
\fB\-\-offline\fR
Expand All @@ -237,6 +242,11 @@ offline.
.sp
May also be specified with the \fBnet.offline\fR \fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
.RE
.sp
\fB\-\-frozen\fR
.RS 4
Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&.
.RE
.SS "Common Options"
.sp
\fB+\fR\fItoolchain\fR
Expand Down

0 comments on commit d1e72bc

Please sign in to comment.