Complete best build and report

This commit is contained in:
2023-09-22 01:03:55 +02:00
parent c4d0a5b4e6
commit c4f9187e2a
4 changed files with 56 additions and 11 deletions

View File

@@ -2,14 +2,15 @@
#include <argparse/argparse.hpp>
#include "Paths.h"
#include "BestResults.h"
#include "Colors.h"
using namespace std;
argparse::ArgumentParser manageArguments(int argc, char** argv)
{
argparse::ArgumentParser program("best");
program.add_argument("-m", "--model").default_value("any").help("Filter results of the selected model)");
program.add_argument("-s", "--score").default_value("any").help("Filter results of the score name supplied");
program.add_argument("-m", "--model").default_value("").help("Filter results of the selected model)");
program.add_argument("-s", "--score").default_value("").help("Filter results of the score name supplied");
program.add_argument("--build").help("build best score results file").default_value(false).implicit_value(true);
program.add_argument("--report").help("report of best score results file").default_value(false).implicit_value(true);
try {
@@ -18,6 +19,9 @@ argparse::ArgumentParser manageArguments(int argc, char** argv)
auto score = program.get<string>("score");
auto build = program.get<bool>("build");
auto report = program.get<bool>("report");
if (model == "" || score == "") {
throw runtime_error("Model and score name must be supplied");
}
}
catch (const exception& err) {
cerr << err.what() << endl;
@@ -35,12 +39,14 @@ int main(int argc, char** argv)
auto build = program.get<bool>("build");
auto report = program.get<bool>("report");
if (!report && !build) {
cout << "Either build, report or both, have to be selected to do anything!" << endl;
cerr << "Either build, report or both, have to be selected to do anything!" << endl;
cerr << program;
exit(1);
}
auto results = platform::BestResults(platform::Paths::results(), model, score);
if (build) {
results.build();
string fileName = results.build();
cout << Colors::GREEN() << fileName << " created!" << Colors::RESET() << endl;
}
if (report) {
results.report();