Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/tools/VersionMain.cpp
diff options
context:
space:
mode:
authorLeitwolf2026-11-15 12:15:51 +0300
committerGitHub2026-11-15 12:15:51 +0300
commitac438d0c34d89e14d51aebe3b0314c7e38000bb8 (patch)
tree537504b761ed21b6fe821aebbbf9eab6b398d054 /tools/VersionMain.cpp
parent94a996a3ceafa9f0004ffc28a7de5c543cdb51c2 (diff)
parente2905c736cf2e36965c071c21bc7911eb3c59a7b (diff)
downloadcatch3-ac438d0c34d89e14d51aebe3b0314c7e38000bb8.tar.gz
Merge pull request #41 from Progmasoft/fix/version-tool-semver
Number versions MAJOR.MINOR.PATCH in the version tool
Diffstat (limited to 'tools/VersionMain.cpp')
-rw-r--r--tools/VersionMain.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/tools/VersionMain.cpp b/tools/VersionMain.cpp
index 6f1c13cb..2c9c5456 100644
--- a/tools/VersionMain.cpp
+++ b/tools/VersionMain.cpp
@@ -2,8 +2,8 @@
// SPDX-License-Identifier: MPL-2.0 WITH AdditionRef-Progmasoft-Exception-2.0
// bazelisk run //tools:version prints the current version
-// bazelisk run //tools:version -- --next moves to the next version
-// bazelisk run //tools:version -- 0.3.1.0 moves to that version
+// bazelisk run //tools:version -- --next moves to the next patch release
+// bazelisk run //tools:version -- 0.4.0 moves to that version
//
// Moving writes every place that states the version, and the amalgamation.
@@ -44,16 +44,19 @@ main(int argc, char **argv)
return 0;
}
const std::string_view argument{ argv[1] };
- const auto parsed = ParseVersion(
- argument == "--next" ? *current : std::string{ argument });
+ const auto parsed
+ = argument == "--next" ? NextPatch(*current) : ParseVersion(argument);
if (!parsed)
{
- std::cerr << "not a version of three or four numbers: " << argument
+ std::cerr << (argument == "--next"
+ ? "the current version is not a release version: "
+ + *current
+ : "not a version MAJOR.MINOR.PATCH: "
+ + std::string{ argument })
<< '\n';
return 2;
}
- const auto version
- = FormatVersion(argument == "--next" ? NextVersion(*parsed) : *parsed);
+ const auto version = FormatVersion(*parsed);
// The sources have to make a distribution before anything is changed.
(void)GenerateAmalgamation(*root, problems);
if (problems.empty())