Monopoly — Portage moderne 0.1.0
Portage moderne C/C++23 du Monopoly de 1999
Loading...
Searching...
No Matches
ManifestTool.cpp
Go to the documentation of this file.
1#include "LegacyManifest.hpp"
2
3#include <filesystem>
4#include <iostream>
5#include <vector>
6
7int main(int argumentCount, char** arguments)
8{
9 using namespace monopoly::data;
10
11 if (argumentCount < 3)
12 {
13 std::cerr
14 << "usage: MonopolyManifestTool <output.tsv> <DMake-header>...\n";
15 return 2;
16 }
17
18 std::vector<LegacyBankManifest> manifests;
19 manifests.reserve(static_cast<std::size_t>(argumentCount - 2));
20
21 for (int index = 2; index < argumentCount; ++index)
22 {
23 auto manifest = readDmakeManifest(arguments[index]);
24
25 if (!manifest)
26 {
27 std::cerr
28 << manifestErrorCodeName(manifest.error().code)
29 << ": " << manifest.error().path.string()
30 << ':' << manifest.error().line
31 << ": " << manifest.error().detail << '\n';
32 return 1;
33 }
34
35 manifests.push_back(std::move(*manifest));
36 }
37
38 auto written = writeManifestTsv(arguments[1], manifests);
39
40 if (!written)
41 {
42 std::cerr
43 << manifestErrorCodeName(written.error().code)
44 << ": " << written.error().path.string()
45 << ": " << written.error().detail << '\n';
46 return 1;
47 }
48
49 return 0;
50}
int main(int argumentCount, char **arguments)
unsigned index