Skip to content

doc: add public info in cargo-add man page. #13272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/bin/cargo/commands/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
16 changes: 16 additions & 0 deletions src/doc/man/cargo-add.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
17 changes: 17 additions & 0 deletions src/doc/man/generated_txt/cargo-add.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,23 @@ OPTIONS
Mark the dependency as required
<https://doc.rust-lang.org/cargo/reference/features.html#optional-dependencies>.

--public
Mark the dependency as public.

The dependency can be referenced in your library’s public API.

Unstable (nightly-only)
<https://doc.rust-lang.org/cargo/reference/unstable.html#public-dependency>

--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)
<https://doc.rust-lang.org/cargo/reference/unstable.html#public-dependency>

--no-default-features
Disable the default features
<https://doc.rust-lang.org/cargo/reference/features.html#dependency-features>.
Expand Down
12 changes: 12 additions & 0 deletions src/doc/src/commands/cargo-add.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,18 @@ which is defined by the <code>registry.default</code> config key which defaults
<dd class="option-desc">Mark the dependency as <a href="../reference/features.html#optional-dependencies">required</a>.</dd>


<dt class="option-term" id="option-cargo-add---public"><a class="option-anchor" href="#option-cargo-add---public"></a><code>--public</code></dt>
<dd class="option-desc">Mark the dependency as public. </p>
<p>The dependency can be referenced in your library’s public API.</p>
<p><a href="../reference/unstable.html#public-dependency">Unstable (nightly-only)</a></dd>


<dt class="option-term" id="option-cargo-add---no-public"><a class="option-anchor" href="#option-cargo-add---no-public"></a><code>--no-public</code></dt>
<dd class="option-desc">Mark the dependency as private. </p>
<p>While you can use the crate in your implementation, it cannot be referenced in your public API.</p>
<p><a href="../reference/unstable.html#public-dependency">Unstable (nightly-only)</a></dd>


<dt class="option-term" id="option-cargo-add---no-default-features"><a class="option-anchor" href="#option-cargo-add---no-default-features"></a><code>--no-default-features</code></dt>
<dd class="option-desc">Disable the <a href="../reference/features.html#dependency-features">default features</a>.</dd>

Expand Down
18 changes: 18 additions & 0 deletions src/etc/man/cargo-add.1
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,24 @@ Mark the dependency as \fIoptional\fR <https://doc.rust\-lang.org/cargo/referenc
Mark the dependency as \fIrequired\fR <https://doc.rust\-lang.org/cargo/reference/features.html#optional\-dependencies>\&.
.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 <https://doc.rust\-lang.org/cargo/reference/unstable.html#public\-dependency>
.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 <https://doc.rust\-lang.org/cargo/reference/unstable.html#public\-dependency>
.RE
.sp
\fB\-\-no\-default\-features\fR
.RS 4
Disable the \fIdefault features\fR <https://doc.rust\-lang.org/cargo/reference/features.html#dependency\-features>\&.
Expand Down
4 changes: 2 additions & 2 deletions tests/testsuite/cargo_add/help/stdout.log
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down