Skip to content

Commit

Permalink
doc: add public info in cargo-add man page.
Browse files Browse the repository at this point in the history
  • Loading branch information
linyihai committed Jan 9, 2024
1 parent 8859998 commit 0ac0a18
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 5 deletions.
6 changes: 3 additions & 3 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")
.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
12 changes: 12 additions & 0 deletions src/doc/man/cargo-add.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
12 changes: 12 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,18 @@ OPTIONS
Mark the dependency as required
<https://doc.rust-lang.org/cargo/reference/features.html#optional-dependencies>.

--public
Mark the dependency as public.

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

--no-public
Mark the dependency as private.

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
10 changes: 10 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,16 @@ 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><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><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
14 changes: 14 additions & 0 deletions src/etc/man/cargo-add.1
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,20 @@ 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
\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
\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

0 comments on commit 0ac0a18

Please sign in to comment.