Skip to content

Commit 91bf01b

Browse files
committed
Document cargo remove
1 parent 882c5dd commit 91bf01b

File tree

10 files changed

+616
-4
lines changed

10 files changed

+616
-4
lines changed

src/bin/cargo/cli.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ Some common cargo commands are (see all commands with --list):
435435
new Create a new cargo package
436436
init Create a new cargo package in an existing directory
437437
add Add dependencies to a manifest file
438+
remove Remove dependencies from a manifest file
438439
run, r Run a binary or example of the local package
439440
test, t Run the tests
440441
bench Run the benchmarks

src/doc/man/cargo-add.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,4 @@ which enables all specified features.
159159
cargo add serde serde_json -F serde/derive
160160

161161
## SEE ALSO
162-
{{man "cargo" 1}}
162+
{{man "cargo" 1}}, {{man "cargo-remove" 1}}

src/doc/man/cargo-remove.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# cargo-remove(1)
2+
{{*set actionverb="Remove"}}
3+
{{*set nouns="removes"}}
4+
5+
## NAME
6+
7+
cargo-remove - Remove dependencies from a Cargo.toml manifest file
8+
9+
## SYNOPSIS
10+
11+
`cargo remove` [_options_] _dependency_...
12+
13+
## DESCRIPTION
14+
15+
Remove one or more dependencies from a `Cargo.toml` manifest.
16+
17+
After the manifest has been edited, `Cargo.lock` will be updated to reflect any changes.
18+
19+
## OPTIONS
20+
21+
### Section options
22+
23+
{{#options}}
24+
25+
{{#option "`--dev`" }}
26+
Remove as a [development dependency](../reference/specifying-dependencies.html#development-dependencies).
27+
{{/option}}
28+
29+
{{#option "`--build`" }}
30+
Remove as a [build dependency](../reference/specifying-dependencies.html#build-dependencies).
31+
{{/option}}
32+
33+
{{#option "`--target` _target_" }}
34+
Remove as a dependency to the [given target platform](../reference/specifying-dependencies.html#platform-specific-dependencies).
35+
{{/option}}
36+
37+
{{/options}}
38+
39+
### Miscellaneous Options
40+
41+
{{#options}}
42+
43+
{{#option "`--dry-run`" }}
44+
Don't actually write to the manifest.
45+
{{/option}}
46+
47+
{{/options}}
48+
49+
### Display Options
50+
51+
{{#options}}
52+
{{> options-display }}
53+
{{/options}}
54+
55+
### Manifest Options
56+
57+
{{#options}}
58+
{{> options-manifest-path }}
59+
60+
{{> options-locked }}
61+
{{/options}}
62+
63+
### Package Selection
64+
65+
{{#options}}
66+
67+
{{#option "`-p` _spec_..." "`--package` _spec_..." }}
68+
Package to remove from.
69+
{{/option}}
70+
71+
{{/options}}
72+
73+
{{> section-options-common }}
74+
75+
{{> section-environment }}
76+
77+
{{> section-exit-status }}
78+
79+
## EXAMPLES
80+
81+
1. Remove `regex` as a dependency
82+
83+
cargo remove regex
84+
85+
2. Remove `trybuild` as a dev-dependency
86+
87+
cargo remove --dev trybuild
88+
89+
3. Remove `nom` from the `x86_64-pc-windows-gnu` dependencies table
90+
91+
cargo remove --target x86_64-pc-windows-gnu nom
92+
93+
## SEE ALSO
94+
{{man "cargo" 1}}, {{man "cargo-add" 1}}

src/doc/man/generated_txt/cargo-add.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,5 +188,5 @@ EXAMPLES
188188
cargo add serde serde_json -F serde/derive
189189

190190
SEE ALSO
191-
cargo(1)
191+
cargo(1), cargo-remove(1)
192192

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
CARGO-REMOVE(1)
2+
3+
NAME
4+
cargo-remove - Remove dependencies from a Cargo.toml manifest file
5+
6+
SYNOPSIS
7+
cargo remove [options] dependency...
8+
9+
DESCRIPTION
10+
Remove one or more dependencies from a Cargo.toml manifest.
11+
12+
After the manifest has been edited, Cargo.lock will be updated to
13+
reflect any changes.
14+
15+
OPTIONS
16+
Section options
17+
--dev
18+
Remove as a development dependency
19+
<https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#development-dependencies>.
20+
21+
--build
22+
Remove as a build dependency
23+
<https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#build-dependencies>.
24+
25+
--target target
26+
Remove as a dependency to the given target platform
27+
<https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#platform-specific-dependencies>.
28+
29+
Miscellaneous Options
30+
--dry-run
31+
Don't actually write to the manifest.
32+
33+
Display Options
34+
-v, --verbose
35+
Use verbose output. May be specified twice for "very verbose" output
36+
which includes extra output such as dependency warnings and build
37+
script output. May also be specified with the term.verbose config
38+
value <https://doc.rust-lang.org/cargo/reference/config.html>.
39+
40+
-q, --quiet
41+
Do not print cargo log messages. May also be specified with the
42+
term.quiet config value
43+
<https://doc.rust-lang.org/cargo/reference/config.html>.
44+
45+
--color when
46+
Control when colored output is used. Valid values:
47+
48+
o auto (default): Automatically detect if color support is
49+
available on the terminal.
50+
51+
o always: Always display colors.
52+
53+
o never: Never display colors.
54+
55+
May also be specified with the term.color config value
56+
<https://doc.rust-lang.org/cargo/reference/config.html>.
57+
58+
Manifest Options
59+
--manifest-path path
60+
Path to the Cargo.toml file. By default, Cargo searches for the
61+
Cargo.toml file in the current directory or any parent directory.
62+
63+
--frozen, --locked
64+
Either of these flags requires that the Cargo.lock file is
65+
up-to-date. If the lock file is missing, or it needs to be updated,
66+
Cargo will exit with an error. The --frozen flag also prevents Cargo
67+
from attempting to access the network to determine if it is
68+
out-of-date.
69+
70+
These may be used in environments where you want to assert that the
71+
Cargo.lock file is up-to-date (such as a CI build) or want to avoid
72+
network access.
73+
74+
--offline
75+
Prevents Cargo from accessing the network for any reason. Without
76+
this flag, Cargo will stop with an error if it needs to access the
77+
network and the network is not available. With this flag, Cargo will
78+
attempt to proceed without the network if possible.
79+
80+
Beware that this may result in different dependency resolution than
81+
online mode. Cargo will restrict itself to crates that are
82+
downloaded locally, even if there might be a newer version as
83+
indicated in the local copy of the index. See the cargo-fetch(1)
84+
command to download dependencies before going offline.
85+
86+
May also be specified with the net.offline config value
87+
<https://doc.rust-lang.org/cargo/reference/config.html>.
88+
89+
Package Selection
90+
-p spec..., --package spec...
91+
Package to remove from.
92+
93+
Common Options
94+
+toolchain
95+
If Cargo has been installed with rustup, and the first argument to
96+
cargo begins with +, it will be interpreted as a rustup toolchain
97+
name (such as +stable or +nightly). See the rustup documentation
98+
<https://rust-lang.github.io/rustup/overrides.html> for more
99+
information about how toolchain overrides work.
100+
101+
--config KEY=VALUE or PATH
102+
Overrides a Cargo configuration value. The argument should be in
103+
TOML syntax of KEY=VALUE, or provided as a path to an extra
104+
configuration file. This flag may be specified multiple times. See
105+
the command-line overrides section
106+
<https://doc.rust-lang.org/cargo/reference/config.html#command-line-overrides>
107+
for more information.
108+
109+
-h, --help
110+
Prints help information.
111+
112+
-Z flag
113+
Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
114+
details.
115+
116+
ENVIRONMENT
117+
See the reference
118+
<https://doc.rust-lang.org/cargo/reference/environment-variables.html>
119+
for details on environment variables that Cargo reads.
120+
121+
EXIT STATUS
122+
o 0: Cargo succeeded.
123+
124+
o 101: Cargo failed to complete.
125+
126+
EXAMPLES
127+
1. Remove regex as a dependency
128+
129+
cargo remove regex
130+
131+
2. Remove trybuild as a dev-dependency
132+
133+
cargo remove --dev trybuild
134+
135+
3. Remove nom from the x86_64-pc-windows-gnu dependencies table
136+
137+
cargo remove --target x86_64-pc-windows-gnu nom
138+
139+
SEE ALSO
140+
cargo(1), cargo-add(1)
141+

src/doc/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
* [cargo locate-project](commands/cargo-locate-project.md)
6767
* [cargo metadata](commands/cargo-metadata.md)
6868
* [cargo pkgid](commands/cargo-pkgid.md)
69+
* [cargo remove](commands/cargo-remove.md)
6970
* [cargo tree](commands/cargo-tree.md)
7071
* [cargo update](commands/cargo-update.md)
7172
* [cargo vendor](commands/cargo-vendor.md)

src/doc/src/commands/cargo-add.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,4 +231,4 @@ details on environment variables that Cargo reads.
231231
cargo add serde serde_json -F serde/derive
232232

233233
## SEE ALSO
234-
[cargo(1)](cargo.html)
234+
[cargo(1)](cargo.html), [cargo-remove(1)](cargo-remove.html)

0 commit comments

Comments
 (0)