diff options
| author | Leitwolf | 2026-11-02 00:51:11 +0300 |
|---|---|---|
| committer | GitHub | 2026-11-02 00:51:11 +0300 |
| commit | 268698be92962247a21a86dda4de2d4267adcf8f (patch) | |
| tree | 510f7ece1750b2da6d9b4666b7c58908c8d193bb /tools/ReleaseNotesMain.cpp | |
| parent | 13324a043042110eba456424fa39c1334857ceaa (diff) | |
| parent | 3ed0fd930371823b6d44ae64d00dbd79e421a552 (diff) | |
| download | catch3-268698be92962247a21a86dda4de2d4267adcf8f.tar.gz | |
Merge pull request #36 from Progmasoft/feature/cpp-tools
Move the tools from Python to C++17 and Bazel
Diffstat (limited to 'tools/ReleaseNotesMain.cpp')
| -rw-r--r-- | tools/ReleaseNotesMain.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/tools/ReleaseNotesMain.cpp b/tools/ReleaseNotesMain.cpp new file mode 100644 index 00000000..b32b57b0 --- /dev/null +++ b/tools/ReleaseNotesMain.cpp @@ -0,0 +1,49 @@ +// Copyright (c) 2026 Progmasoft. +// SPDX-License-Identifier: MPL-2.0 WITH AdditionRef-Progmasoft-Exception-2.0 + +// bazelisk run //tools:release_notes -- [version] +// +// Prints a section of docs/release-notes.md, of the current version without +// an argument, for the text of a GitHub release. + +#include <iostream> +#include <string> + +#include "tools/Repository.hpp" +#include "tools/Versions.hpp" + +int +main(int argc, char **argv) +{ + using namespace Progmasoft::Catch3::Tools; + + if (argc > 2) + { + std::cerr << "usage: bazelisk run //tools:release_notes -- [version]\n"; + return 2; + } + const auto root = RepositoryRoot(); + if (!root) + { + std::cerr << "run this tool with bazelisk run\n"; + return 2; + } + Problems problems; + const auto version = argc == 2 ? std::optional<std::string>{ argv[1] } + : CurrentVersion(*root, problems); + const auto notes + = ReadOrReport(*root / "docs" / "release-notes.md", problems); + if (!version || !problems.empty()) + { + return Finish(problems); + } + const auto section = ReleaseNotesOf(notes, *version); + if (!section) + { + problems.push_back("no section for " + *version + + " in docs/release-notes.md"); + return Finish(problems); + } + std::cout << *section; + return 0; +} |