A command-line tool for updating versions in one or more Cargo.toml files, creating a Git tag, and committing the changes.
- Update the version number in one or multiple
Cargo.tomlfiles. - Create a Git tag for the new version.
- Commit the changes automatically.
- Supports version increments and fixed version setting.
- Can scan subdirectories for
Cargo.tomlfiles. - Pushes changes and tags to a remote repository.
Ensure you have Rust and Cargo installed on your system. Then, install the tool using:
cargo install cargo-git-version-setterAlternatively, you can build from source:
git clone https://github.com/yourusername/cargo-git-version-setter.git
cd cargo-git-version-setter
cargo build --releaseRun the tool with a command:
cgvs [OPTIONS] <COMMAND>fixed <FULL_VERSION>- Set a fixed version.increment <VTYPE>- Increment part of the version. When incrementing major or minor version parts, the lower version parts are set to zero.only-show- Show versions from Cargo and Git, then exit.
Set a specific version for the project.
Usage:
cgvs fixed <FULL_VERSION>Arguments:
<FULL_VERSION>- The version to set.
Options:
-h, --help- Print help information.
Increment a specific part of the version. When incrementing major or minor version parts, the lower version parts are reset to zero.
Usage:
cgvs increment <VTYPE>Arguments:
<VTYPE>- The version part to increment. Possible values:patch- Patch version for backward-compatible bug fixes.minor- Minor version for backward-compatible feature additions.major- Major version for breaking API changes.
Options:
-h, --help- Print help information.
Display versions from Cargo and Git, then exit without making changes.
Usage:
cgvs only-showOptions:
-h, --help- Print help information.
-p, --path <PATH>- Path of the project.-c, --cargo-file-selector <CARGO_FILE_SELECTOR>- Select cargo file if multiple exist (leaf,base, orall).-s, --scan-subdirs- Scan subdirectories forCargo.tomlfiles.-v, --verbose- Enable debugging output.-t, --tag-message <TAG_MESSAGE>- Message when adding the tag to Git.-r, --remote <REMOTE>- Git remote name to push new commits to (default:origin).-g, --git-prefix-for-tag <GIT_PREFIX_FOR_TAG>- Prefix for the version tag (default:v).-h, --help- Show help.-V, --version- Show version.
- Updates the
versionfield in all detectedCargo.tomlfiles. - Stages and commits the changes with a message (default:
chore: bump version to <new-version>). - Creates a Git tag for the new version.
- Pushes the commit and tag (if
--do-pushis used).
To set a fixed version and create a Git tag:
cgvs fixed 2.0.0To increment the minor version:
cgvs increment minorTo show current versions without making changes:
cgvs only-showTo scan subdirectories and apply changes:
cgvs fixed 2.0.0 --scan-subdirsThis project is licensed under the MIT License.
Feel free to submit issues or pull requests to improve this tool!