Skip to content
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

Notice for potential unexpected shell expansions in help text of cargo-add #11826

Merged
merged 2 commits into from
Mar 10, 2023
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
9 changes: 6 additions & 3 deletions src/doc/man/cargo-add.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,12 @@ 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}}


</dl>

### Dependency options

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

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

Dependency options
--dry-run
Expand Down Expand Up @@ -226,6 +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
10 changes: 6 additions & 4 deletions src/doc/src/commands/cargo-add.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +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>


</dl>
<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 @@ -272,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
13 changes: 12 additions & 1 deletion src/etc/man/cargo-add.1
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ 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
</dl>
.SS "Dependency options"
.sp
\fB\-\-dry\-run\fR
Expand Down Expand Up @@ -308,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