From f9c9185f36c40fa2a1d7e7af86515ca9e5a90699 Mon Sep 17 00:00:00 2001
From: Lin Yihai
Date: Tue, 9 Jan 2024 00:57:29 +0800
Subject: [PATCH] doc: add `public` info in `cargo-add` man page.
---
src/bin/cargo/commands/add.rs | 8 ++++++--
src/doc/man/cargo-add.md | 12 ++++++++++++
src/doc/man/generated_txt/cargo-add.txt | 12 ++++++++++++
src/doc/src/commands/cargo-add.md | 10 ++++++++++
src/etc/man/cargo-add.1 | 14 ++++++++++++++
tests/testsuite/cargo_add/help/stdout.log | 6 ++++++
6 files changed, 60 insertions(+), 2 deletions(-)
diff --git a/src/bin/cargo/commands/add.rs b/src/bin/cargo/commands/add.rs
index 55a074282024..f408843b9423 100644
--- a/src/bin/cargo/commands/add.rs
+++ b/src/bin/cargo/commands/add.rs
@@ -67,14 +67,18 @@ The package will be removed from your features.")
.conflicts_with("build")
.long_help("Mark the dependency as public
-The dependency can be referenced in your library's public API."),
+The dependency can be referenced in your library's public API.
+
+Unstable (nightly-only) "),
flag("no-public", "Mark the dependency as private")
.conflicts_with("dev")
.conflicts_with("build")
.overrides_with("public")
.long_help("Mark the dependency as private
-While you can use the crate in your implementation, it cannot be referenced in your public API."),
+While you can use the crate in your implementation, it cannot be referenced in your public API.
+
+Unstable (nightly-only) "),
clap::Arg::new("rename")
.long("rename")
.action(ArgAction::Set)
diff --git a/src/doc/man/cargo-add.md b/src/doc/man/cargo-add.md
index d3a62900a062..202dbd5efb3b 100644
--- a/src/doc/man/cargo-add.md
+++ b/src/doc/man/cargo-add.md
@@ -107,6 +107,18 @@ Mark the dependency as [optional](../reference/features.html#optional-dependenci
Mark the dependency as [required](../reference/features.html#optional-dependencies).
{{/option}}
+{{#option "`--public`" }}
+Mark the dependency as public.
+
+[Unstable (nightly-only)](../reference/unstable.html#public-dependency)
+{{/option}}
+
+{{#option "`--no-public`" }}
+Mark the dependency as private.
+
+[Unstable (nightly-only)](../reference/unstable.html#public-dependency)
+{{/option}}
+
{{#option "`--no-default-features`" }}
Disable the [default features](../reference/features.html#dependency-features).
{{/option}}
diff --git a/src/doc/man/generated_txt/cargo-add.txt b/src/doc/man/generated_txt/cargo-add.txt
index 3bd4bd5aa91a..0c1bd49a8ddb 100644
--- a/src/doc/man/generated_txt/cargo-add.txt
+++ b/src/doc/man/generated_txt/cargo-add.txt
@@ -96,6 +96,18 @@ OPTIONS
Mark the dependency as required
.
+ --public
+ Mark the dependency as public.
+
+ Unstable (nightly-only)
+
+
+ --no-public
+ Mark the dependency as private.
+
+ Unstable (nightly-only)
+
+
--no-default-features
Disable the default features
.
diff --git a/src/doc/src/commands/cargo-add.md b/src/doc/src/commands/cargo-add.md
index 68b7c4c364c6..66dc13ee9e46 100644
--- a/src/doc/src/commands/cargo-add.md
+++ b/src/doc/src/commands/cargo-add.md
@@ -107,6 +107,16 @@ which is defined by the registry.default
config key which defaults
Mark the dependency as required.
+--public
+Mark the dependency as public.
+Unstable (nightly-only)
+
+
+
--no-public
+Mark the dependency as private.
+Unstable (nightly-only)
+
+
--no-default-features
Disable the default features.
diff --git a/src/etc/man/cargo-add.1 b/src/etc/man/cargo-add.1
index 4e8b685667d6..0f49d521adbb 100644
--- a/src/etc/man/cargo-add.1
+++ b/src/etc/man/cargo-add.1
@@ -121,6 +121,20 @@ Mark the dependency as \fIoptional\fR \&.
.RE
.sp
+\fB\-\-public\fR
+.RS 4
+Mark the dependency as public.
+.sp
+\fIUnstable (nightly\-only)\fR
+.RE
+.sp
+\fB\-\-no\-public\fR
+.RS 4
+Mark the dependency as private.
+.sp
+\fIUnstable (nightly\-only)\fR
+.RE
+.sp
\fB\-\-no\-default\-features\fR
.RS 4
Disable the \fIdefault features\fR \&.
diff --git a/tests/testsuite/cargo_add/help/stdout.log b/tests/testsuite/cargo_add/help/stdout.log
index d2931ae9cd41..250abed32943 100644
--- a/tests/testsuite/cargo_add/help/stdout.log
+++ b/tests/testsuite/cargo_add/help/stdout.log
@@ -36,12 +36,18 @@ Options:
Mark the dependency as public
The dependency can be referenced in your library's public API.
+
+ Unstable (nightly-only)
+
--no-public
Mark the dependency as private
While you can use the crate in your implementation, it cannot be referenced in your public
API.
+
+ Unstable (nightly-only)
+
--rename
Rename the dependency