Usage: version [OPTIONS] [VERSION_BUMP]
Arguments:
[VERSION_BUMP] If not provided, configured to read from git, will attempt to infer the bump from the git commit message, else `prepatch` [possible values: prepatch, patch, preminor, minor, major, skip]
Options:
--from-git Infer version bump from git commit messages
--workspace Expect to find a workspace rather than a normal project
--message-file <FILE> Path to commit message file
--path <FILE> Path to manifest file [default: Cargo.toml]
--quiet Suppress all output except errors
-h, --help Print help
-V, --version Print version
# .git/hooks/prepare-commit-msg
if [ command -v version &> /dev/null ]; then
cargo install --git https://github.com/charliethomson/version
fi
# Only run for regular commits
if [ -z "${2:-}" ] || [ "$2" = "message" ]; then
echo "Running version bump..."
if version --from-git --message-file "$1" --workspace-manifest Cargo.toml; then
if ! git diff --quiet Cargo.toml; then
# Mark that we need to amend the commit
touch .git/NEED_VERSION_AMEND
fi
else
exit 1
fi
fi