LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

cargo-set-version

Change a Rust package version in Cargo.toml

TLDR

Set an exact version
$ cargo set-version [1.0.0]
copy
Bump major version
$ cargo set-version --bump major
copy
Bump minor version
$ cargo set-version --bump minor
copy
Bump patch version
$ cargo set-version --bump patch
copy
Apply to whole workspace
$ cargo set-version --workspace --bump patch
copy
Dry-run
$ cargo set-version -n --bump minor
copy

SYNOPSIS

cargo set-version [*options*] [*TARGET*]

DESCRIPTION

cargo set-version (from cargo-edit) changes the version field in a local Cargo.toml. You can set an absolute version or bump major/minor/patch. Workspace-wide updates are supported.Install with cargo install cargo-edit.

PARAMETERS

*TARGET*

Absolute version to set (for example 1.2.3), when not using --bump.
--bump major|minor|patch|...
Increment the corresponding semver component.
-m, --metadata *METADATA*
Set the version metadata field (for example build metadata).
-p, --package *PKGID*
Select a package in a workspace.
--workspace
Modify all packages in the workspace.
--exclude *EXCLUDE*
Skip crates when using workspace mode.
-n, --dry-run
Print changes without writing files.
--manifest-path *PATH*
Path to the manifest to edit.
--offline
Run without network access.
--locked
Require Cargo.toml to be up to date with the lockfile as configured.
See cargo set-version --help for the complete flag set.

INSTALL

sudo pacman -S cargo-edit
copy
sudo apk add cargo-edit
copy
brew install cargo-edit
copy
nix profile install nixpkgs#cargo-edit
copy

CAVEATS

Does not publish crates; it only edits manifests. Coordinate version bumps with tags and changelog process separately. Workspace bumps can touch many crates at once; use --dry-run first.

SEE ALSO

RESOURCES

Copied to clipboard
Kai