From f141c10bda3af60aa77e6bdc683839eeef8b0f07 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 | 16 ++++++++++++++++
src/doc/man/generated_txt/cargo-add.txt | 17 +++++++++++++++++
src/doc/src/commands/cargo-add.md | 12 ++++++++++++
src/etc/man/cargo-add.1 | 18 ++++++++++++++++++
tests/testsuite/cargo_add/help/stdout.log | 4 ++--
6 files changed, 69 insertions(+), 6 deletions(-)
diff --git a/src/bin/cargo/commands/add.rs b/src/bin/cargo/commands/add.rs
index 55a07428202..f4d2ee051c4 100644
--- a/src/bin/cargo/commands/add.rs
+++ b/src/bin/cargo/commands/add.rs
@@ -62,17 +62,17 @@ The package name will be exposed as feature of your crate.")
The package will be removed from your features.")
.conflicts_with("dev")
.overrides_with("optional"),
- flag("public", "Mark the dependency as public")
+ flag("public", "Mark the dependency as public (unstable)")
.conflicts_with("dev")
.conflicts_with("build")
- .long_help("Mark the dependency as public
+ .long_help("Mark the dependency as public (unstable)
The dependency can be referenced in your library's public API."),
- flag("no-public", "Mark the dependency as private")
+ flag("no-public", "Mark the dependency as private (unstable)")
.conflicts_with("dev")
.conflicts_with("build")
.overrides_with("public")
- .long_help("Mark the dependency as private
+ .long_help("Mark the dependency as private (unstable)
While you can use the crate in your implementation, it cannot be referenced in your public API."),
clap::Arg::new("rename")
diff --git a/src/doc/man/cargo-add.md b/src/doc/man/cargo-add.md
index d3a62900a06..96ac12b0dbc 100644
--- a/src/doc/man/cargo-add.md
+++ b/src/doc/man/cargo-add.md
@@ -107,6 +107,22 @@ 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.
+
+The dependency can be referenced in your library's public API.
+
+[Unstable (nightly-only)](../reference/unstable.html#public-dependency)
+{{/option}}
+
+{{#option "`--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)](../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 3bd4bd5aa91..d9ec429c21a 100644
--- a/src/doc/man/generated_txt/cargo-add.txt
+++ b/src/doc/man/generated_txt/cargo-add.txt
@@ -96,6 +96,23 @@ OPTIONS
Mark the dependency as required
.
+ --public
+ 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)
+
+
--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 68b7c4c364c..30585fe9c3b 100644
--- a/src/doc/src/commands/cargo-add.md
+++ b/src/doc/src/commands/cargo-add.md
@@ -107,6 +107,18 @@ which is defined by the registry.default
config key which defaults
Mark the dependency as required.
+--public
+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)
+
+
--no-default-features
Disable the default features.
diff --git a/src/etc/man/cargo-add.1 b/src/etc/man/cargo-add.1
index 4e8b685667d..e7b728a6771 100644
--- a/src/etc/man/cargo-add.1
+++ b/src/etc/man/cargo-add.1
@@ -121,6 +121,24 @@ Mark the dependency as \fIoptional\fR \&.
.RE
.sp
+\fB\-\-public\fR
+.RS 4
+Mark the dependency as public.
+.sp
+The dependency can be referenced in your library\[cq]s public API.
+.sp
+\fIUnstable (nightly\-only)\fR
+.RE
+.sp
+\fB\-\-no\-public\fR
+.RS 4
+Mark the dependency as private.
+.sp
+While you can use the crate in your implementation, it cannot be referenced in your public API.
+.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 d2931ae9cd4..ee738a3e59c 100644
--- a/tests/testsuite/cargo_add/help/stdout.log
+++ b/tests/testsuite/cargo_add/help/stdout.log
@@ -33,12 +33,12 @@ Options:
The package will be removed from your features.
--public
- Mark the dependency as public
+ Mark the dependency as public (unstable)
The dependency can be referenced in your library's public API.
--no-public
- Mark the dependency as private
+ Mark the dependency as private (unstable)
While you can use the crate in your implementation, it cannot be referenced in your public
API.