table of contents
- bookworm 0.66.0+ds1-1
- testing 1.82.0+dfsg1-2
- unstable 1.83.0+dfsg1-1
- experimental 1.83.0+dfsg1-1~exp1
CARGO-ADD(1) | General Commands Manual | CARGO-ADD(1) |
NAME¶
cargo-add - Add dependencies to a Cargo.toml manifest file
SYNOPSIS¶
cargo add [options] crate...
cargo add [options] --path path
cargo add [options] --git url
[crate...]
DESCRIPTION¶
This command can add or modify dependencies.
The source for the dependency can be specified with:
If no source is specified, then a best effort will be made to select one, including:
When you add a package that is already present, the existing entry will be updated with the flags specified.
Upon successful invocation, the enabled (+) and disabled (-) features <https://doc.rust-lang.org/cargo/reference/features.md> of the specified dependency will be listed in the command's output.
OPTIONS¶
Source options¶
--git url
--branch branch
--tag tag
--rev sha
--path path
--registry registry
Section options¶
--dev
--build
--target target
Dependency options¶
--rename name
--optional
--no-optional
--no-default-features
--default-features
--features features
Display Options¶
-v, --verbose
-q, --quiet
--color when
May also be specified with the term.color config value <https://doc.rust-lang.org/cargo/reference/config.html>.
Manifest Options¶
--manifest-path path
Common Options¶
+toolchain
--config KEY=VALUE or PATH
-h, --help
-Z flag
ENVIRONMENT¶
See the reference <https://doc.rust-lang.org/cargo/reference/environment-variables.html> for details on environment variables that Cargo reads.
EXIT STATUS¶
EXAMPLES¶
cargo add regex
cargo add --dev trybuild
cargo add nom@5
cargo add serde serde_json -F serde/derive