From fc18f7669484df58a75b6120bec69098921d3baa Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Fri, 10 Mar 2023 09:58:29 +0000 Subject: [PATCH 1/2] Remove sneaked-in `` --- src/doc/man/cargo-add.md | 3 --- src/doc/man/generated_txt/cargo-add.txt | 3 --- src/doc/src/commands/cargo-add.md | 3 --- src/etc/man/cargo-add.1 | 1 - 4 files changed, 10 deletions(-) diff --git a/src/doc/man/cargo-add.md b/src/doc/man/cargo-add.md index c9bb2376e0c..24e781f3f2a 100644 --- a/src/doc/man/cargo-add.md +++ b/src/doc/man/cargo-add.md @@ -85,9 +85,6 @@ Add as a dependency to the [given target platform](../reference/specifying-depen {{/options}} - - - ### Dependency options {{#options}} diff --git a/src/doc/man/generated_txt/cargo-add.txt b/src/doc/man/generated_txt/cargo-add.txt index 8cd30eba335..b9ab9dd36aa 100644 --- a/src/doc/man/generated_txt/cargo-add.txt +++ b/src/doc/man/generated_txt/cargo-add.txt @@ -76,8 +76,6 @@ OPTIONS Add as a dependency to the given target platform . - - Dependency options --dry-run Don’t actually write the manifest @@ -228,4 +226,3 @@ EXAMPLES SEE ALSO cargo(1), cargo-remove(1) - diff --git a/src/doc/src/commands/cargo-add.md b/src/doc/src/commands/cargo-add.md index 1f575b552fc..786345eba9a 100644 --- a/src/doc/src/commands/cargo-add.md +++ b/src/doc/src/commands/cargo-add.md @@ -89,9 +89,6 @@ which is defined by the registry.default config key which defaults
Add as a dependency to the given target platform.
- - - ### Dependency options diff --git a/src/etc/man/cargo-add.1 b/src/etc/man/cargo-add.1 index c93db74f26b..9c4701640c2 100644 --- a/src/etc/man/cargo-add.1 +++ b/src/etc/man/cargo-add.1 @@ -97,7 +97,6 @@ Add as a \fIbuild dependency\fR \&. .RE - .SS "Dependency options" .sp \fB\-\-dry\-run\fR From 4ec1885eda3b11f826ec0d2f5103c63474467d2f Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Fri, 10 Mar 2023 10:11:42 +0000 Subject: [PATCH 2/2] doc: notice for shell expansions for cargo add/remove --- src/doc/man/cargo-add.md | 6 ++++++ src/doc/man/cargo-remove.md | 2 ++ src/doc/man/generated_txt/cargo-add.txt | 8 ++++++++ src/doc/man/generated_txt/cargo-remove.txt | 3 +++ src/doc/src/commands/cargo-add.md | 7 ++++++- src/doc/src/commands/cargo-remove.md | 3 ++- src/etc/man/cargo-add.1 | 12 ++++++++++++ src/etc/man/cargo-remove.1 | 2 ++ 8 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/doc/man/cargo-add.md b/src/doc/man/cargo-add.md index 24e781f3f2a..c441a82b2ff 100644 --- a/src/doc/man/cargo-add.md +++ b/src/doc/man/cargo-add.md @@ -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}} @@ -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}} diff --git a/src/doc/man/cargo-remove.md b/src/doc/man/cargo-remove.md index 0722e6e53de..e38589ccb08 100644 --- a/src/doc/man/cargo-remove.md +++ b/src/doc/man/cargo-remove.md @@ -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}} diff --git a/src/doc/man/generated_txt/cargo-add.txt b/src/doc/man/generated_txt/cargo-add.txt index b9ab9dd36aa..0bf279df1e5 100644 --- a/src/doc/man/generated_txt/cargo-add.txt +++ b/src/doc/man/generated_txt/cargo-add.txt @@ -76,6 +76,9 @@ OPTIONS Add as a dependency to the given target platform . + 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 @@ -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) + diff --git a/src/doc/man/generated_txt/cargo-remove.txt b/src/doc/man/generated_txt/cargo-remove.txt index bac7483188f..7370bbb7314 100644 --- a/src/doc/man/generated_txt/cargo-remove.txt +++ b/src/doc/man/generated_txt/cargo-remove.txt @@ -23,6 +23,9 @@ OPTIONS Remove as a dependency to the given target platform . + 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. diff --git a/src/doc/src/commands/cargo-add.md b/src/doc/src/commands/cargo-add.md index 786345eba9a..acd80034f1c 100644 --- a/src/doc/src/commands/cargo-add.md +++ b/src/doc/src/commands/cargo-add.md @@ -86,7 +86,8 @@ which is defined by the registry.default config key which defaults
--target target
-
Add as a dependency to the given target platform.
+
Add as a dependency to the given target platform.

+

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

@@ -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) diff --git a/src/doc/src/commands/cargo-remove.md b/src/doc/src/commands/cargo-remove.md index 29989815a7b..61718af5fa4 100644 --- a/src/doc/src/commands/cargo-remove.md +++ b/src/doc/src/commands/cargo-remove.md @@ -29,7 +29,8 @@ Remove one or more dependencies from a `Cargo.toml` manifest.
--target target
-
Remove as a dependency to the given target platform.
+
Remove as a dependency to the given target platform.

+

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

diff --git a/src/etc/man/cargo-add.1 b/src/etc/man/cargo-add.1 index 9c4701640c2..8bbfb6d52f7 100644 --- a/src/etc/man/cargo-add.1 +++ b/src/etc/man/cargo-add.1 @@ -96,6 +96,8 @@ Add as a \fIbuild dependency\fR \&. +.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 @@ -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) diff --git a/src/etc/man/cargo-remove.1 b/src/etc/man/cargo-remove.1 index bc07ad23b6f..f8ebf5e9b3e 100644 --- a/src/etc/man/cargo-remove.1 +++ b/src/etc/man/cargo-remove.1 @@ -25,6 +25,8 @@ Remove as a \fIbuild dependency\fR \&. +.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