From 333e8dabbd806b50977e0b87722dee36352f56d7 Mon Sep 17 00:00:00 2001
From: Lin Yihai
Date: Mon, 29 Jan 2024 11:46:11 +0800
Subject: [PATCH] doc: Hide `cargo-fetch` description in offline man page
---
src/doc/man/cargo-fetch.md | 1 +
src/doc/man/generated_txt/cargo-fetch.txt | 3 +--
src/doc/man/includes/options-locked.md | 4 +++-
src/doc/src/commands/cargo-fetch.md | 4 +---
src/etc/man/cargo-fetch.1 | 2 --
5 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/src/doc/man/cargo-fetch.md b/src/doc/man/cargo-fetch.md
index b8a0eb666209..e896ca7581e5 100644
--- a/src/doc/man/cargo-fetch.md
+++ b/src/doc/man/cargo-fetch.md
@@ -2,6 +2,7 @@
{{~*set command="fetch"}}
{{~*set actionverb="Fetch"}}
{{~*set target-default-to-all-arch=true}}
+{{~*set no-fetch-in-offline=true}}
{{~*set multitarget=true}}
## NAME
diff --git a/src/doc/man/generated_txt/cargo-fetch.txt b/src/doc/man/generated_txt/cargo-fetch.txt
index cbd3169c3131..1c30a3540f48 100644
--- a/src/doc/man/generated_txt/cargo-fetch.txt
+++ b/src/doc/man/generated_txt/cargo-fetch.txt
@@ -91,8 +91,7 @@ OPTIONS
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.
+ indicated in the local copy of the index.
May also be specified with the net.offline config value
.
diff --git a/src/doc/man/includes/options-locked.md b/src/doc/man/includes/options-locked.md
index c9ac9524e3cd..b048d371aff0 100644
--- a/src/doc/man/includes/options-locked.md
+++ b/src/doc/man/includes/options-locked.md
@@ -18,8 +18,10 @@ 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.
+{{#if (ne no-fetch-in-offline true)}}
See the {{man "cargo-fetch" 1}} command to download dependencies before going
offline.
+{{/if}}
May also be specified with the `net.offline` [config value](../reference/config.html).
-{{/option}}
+{{/option}}
\ No newline at end of file
diff --git a/src/doc/src/commands/cargo-fetch.md b/src/doc/src/commands/cargo-fetch.md
index aa0be675c2ca..19a00136846b 100644
--- a/src/doc/src/commands/cargo-fetch.md
+++ b/src/doc/src/commands/cargo-fetch.md
@@ -97,9 +97,7 @@ 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.
+if there might be a newer version as indicated in the local copy of the index.
May also be specified with the net.offline
config value.
diff --git a/src/etc/man/cargo-fetch.1 b/src/etc/man/cargo-fetch.1
index 3779b9c28621..428dc882a81f 100644
--- a/src/etc/man/cargo-fetch.1
+++ b/src/etc/man/cargo-fetch.1
@@ -106,8 +106,6 @@ 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 \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