Skip to content

Commit

Permalink
doc: notice for shell expansions for cargo add/remove
Browse files Browse the repository at this point in the history
  • Loading branch information
weihanglo committed Mar 10, 2023
1 parent fc18f76 commit 4ec1885
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/doc/man/cargo-add.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ Add as a [build dependency](../reference/specifying-dependencies.html#build-depe

{{#option "`--target` _target_" }}
Add as a dependency to the [given target platform](../reference/specifying-dependencies.html#platform-specific-dependencies).

To avoid unexpected shell expansions, you may use quotes around each target, e.g., `--target 'cfg(unix)'`.
{{/option}}

{{/options}}
Expand Down Expand Up @@ -166,5 +168,9 @@ Add dependencies to only the specified package.

cargo add serde serde_json -F serde/derive

5. Add `windows` as a platform specific dependency on `cfg(windows)`

cargo add windows --target 'cfg(windows)'

## SEE ALSO
{{man "cargo" 1}}, {{man "cargo-remove" 1}}
2 changes: 2 additions & 0 deletions src/doc/man/cargo-remove.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ Remove as a [build dependency](../reference/specifying-dependencies.html#build-d

{{#option "`--target` _target_" }}
Remove as a dependency to the [given target platform](../reference/specifying-dependencies.html#platform-specific-dependencies).

To avoid unexpected shell expansions, you may use quotes around each target, e.g., `--target 'cfg(unix)'`.
{{/option}}

{{/options}}
Expand Down
8 changes: 8 additions & 0 deletions src/doc/man/generated_txt/cargo-add.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ OPTIONS
Add as a dependency to the given target platform
<https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#platform-specific-dependencies>.

To avoid unexpected shell expansions, you may use quotes around each
target, e.g., --target 'cfg(unix)'.

Dependency options
--dry-run
Don’t actually write the manifest
Expand Down Expand Up @@ -224,5 +227,10 @@ EXAMPLES

cargo add serde serde_json -F serde/derive

5. Add windows as a platform specific dependency on cfg(windows)

cargo add windows --target 'cfg(windows)'

SEE ALSO
cargo(1), cargo-remove(1)

3 changes: 3 additions & 0 deletions src/doc/man/generated_txt/cargo-remove.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ OPTIONS
Remove as a dependency to the given target platform
<https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#platform-specific-dependencies>.

To avoid unexpected shell expansions, you may use quotes around each
target, e.g., --target 'cfg(unix)'.

Miscellaneous Options
--dry-run
Don’t actually write to the manifest.
Expand Down
7 changes: 6 additions & 1 deletion src/doc/src/commands/cargo-add.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ which is defined by the <code>registry.default</code> config key which defaults


<dt class="option-term" id="option-cargo-add---target"><a class="option-anchor" href="#option-cargo-add---target"></a><code>--target</code> <em>target</em></dt>
<dd class="option-desc">Add as a dependency to the <a href="../reference/specifying-dependencies.html#platform-specific-dependencies">given target platform</a>.</dd>
<dd class="option-desc">Add as a dependency to the <a href="../reference/specifying-dependencies.html#platform-specific-dependencies">given target platform</a>.</p>
<p>To avoid unexpected shell expansions, you may use quotes around each target, e.g., <code>--target 'cfg(unix)'</code>.</dd>


</dl>
Expand Down Expand Up @@ -269,5 +270,9 @@ details on environment variables that Cargo reads.

cargo add serde serde_json -F serde/derive

5. Add `windows` as a platform specific dependency on `cfg(windows)`

cargo add windows --target 'cfg(windows)'

## SEE ALSO
[cargo(1)](cargo.html), [cargo-remove(1)](cargo-remove.html)
3 changes: 2 additions & 1 deletion src/doc/src/commands/cargo-remove.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ Remove one or more dependencies from a `Cargo.toml` manifest.


<dt class="option-term" id="option-cargo-remove---target"><a class="option-anchor" href="#option-cargo-remove---target"></a><code>--target</code> <em>target</em></dt>
<dd class="option-desc">Remove as a dependency to the <a href="../reference/specifying-dependencies.html#platform-specific-dependencies">given target platform</a>.</dd>
<dd class="option-desc">Remove as a dependency to the <a href="../reference/specifying-dependencies.html#platform-specific-dependencies">given target platform</a>.</p>
<p>To avoid unexpected shell expansions, you may use quotes around each target, e.g., <code>--target 'cfg(unix)'</code>.</dd>


</dl>
Expand Down
12 changes: 12 additions & 0 deletions src/etc/man/cargo-add.1
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ Add as a \fIbuild dependency\fR <https://doc.rust\-lang.org/cargo/reference/spec
\fB\-\-target\fR \fItarget\fR
.RS 4
Add as a dependency to the \fIgiven target platform\fR <https://doc.rust\-lang.org/cargo/reference/specifying\-dependencies.html#platform\-specific\-dependencies>\&.
.sp
To avoid unexpected shell expansions, you may use quotes around each target, e.g., \fB\-\-target 'cfg(unix)'\fR\&.
.RE
.SS "Dependency options"
.sp
Expand Down Expand Up @@ -307,5 +309,15 @@ cargo add serde serde_json \-F serde/derive
.fi
.RE
.RE
.sp
.RS 4
\h'-04' 5.\h'+01'Add \fBwindows\fR as a platform specific dependency on \fBcfg(windows)\fR
.sp
.RS 4
.nf
cargo add windows \-\-target 'cfg(windows)'
.fi
.RE
.RE
.SH "SEE ALSO"
\fBcargo\fR(1), \fBcargo\-remove\fR(1)
2 changes: 2 additions & 0 deletions src/etc/man/cargo-remove.1
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Remove as a \fIbuild dependency\fR <https://doc.rust\-lang.org/cargo/reference/s
\fB\-\-target\fR \fItarget\fR
.RS 4
Remove as a dependency to the \fIgiven target platform\fR <https://doc.rust\-lang.org/cargo/reference/specifying\-dependencies.html#platform\-specific\-dependencies>\&.
.sp
To avoid unexpected shell expansions, you may use quotes around each target, e.g., \fB\-\-target 'cfg(unix)'\fR\&.
.RE
.SS "Miscellaneous Options"
.sp
Expand Down

0 comments on commit 4ec1885

Please sign in to comment.