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/RepoInfoMain.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/RepoInfoMain.cpp')
| -rw-r--r-- | tools/RepoInfoMain.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tools/RepoInfoMain.cpp b/tools/RepoInfoMain.cpp new file mode 100644 index 00000000..23b7e232 --- /dev/null +++ b/tools/RepoInfoMain.cpp @@ -0,0 +1,34 @@ +// Copyright (c) 2026 Progmasoft. +// SPDX-License-Identifier: MPL-2.0 WITH AdditionRef-Progmasoft-Exception-2.0 + +// bazelisk run //tools:repo_info [-- --json] +// +// Reports the checkout and the tools on PATH, without changing anything. + +#include <iostream> +#include <string_view> + +#include "tools/Repository.hpp" +#include "tools/RepositoryReport.hpp" + +int +main(int argc, char **argv) +{ + using namespace Progmasoft::Catch3::Tools; + + const bool json = argc == 2 && std::string_view{ argv[1] } == "--json"; + if (argc > 2 || (argc == 2 && !json)) + { + std::cerr << "usage: bazelisk run //tools:repo_info [-- --json]\n"; + return 2; + } + const auto root = RepositoryRoot(); + if (!root) + { + std::cerr << "run this tool with bazelisk run\n"; + return 2; + } + const auto report = CollectRepositoryReport(*root); + std::cout << (json ? ReportToJson(report) : FormatReport(report)); + return 0; +} |