Refactor into a oop

This commit is contained in:
2026-06-28 08:18:15 -04:00
parent 1c7909b8f6
commit 1813b3f5cf
9 changed files with 184 additions and 173 deletions

View File

@@ -1,7 +1,5 @@
#include "app.h"
#include "args.h"
#include "commands.h"
#include "logging.h"
#include "types.h"
#ifdef _WIN32
#define popen _popen
@@ -10,41 +8,8 @@
int main(const int argc, char** argv) {
Options options = parse(argc, argv);
Application app(options);
initLogging();
createLogger("app", nullptr, options.verbose.value());
spdlog::get("app")->debug("Creating logger: 'build'.");
createLogger("build", nullptr, options.verbose.value());
spdlog::get("app")->debug("Creating logger: 'configure'.");
createLogger("configure", nullptr, options.verbose.value());
spdlog::get("app")->debug("Creating logger: 'clean'.");
createLogger("clean", nullptr, options.verbose.value());
spdlog::get("app")->debug("Creating logger: 'filesystem'.");
createLogger("filesystem", nullptr, options.verbose.value());
spdlog::get("app")->debug("Creating logger: 'cmd'.");
createLogger("cmd", nullptr, options.verbose.value());
spdlog::get("app")->debug("Loggers created.");
spdlog::get("app")->debug("Running command");
switch (options.command) {
case build:
buildProject(options.buildType.value(), options.dryrun.value());
break;
case configure:
configureProject(options.buildType.value(), options.dryrun.value());
break;
case clean:
cleanProject(options.buildType.value(), options.dryrun.value());
break;
case del:
deleteProject(options.buildType.value(), options.dryrun.value());
break;
case rebuild:
rebuildProject(options.buildType.value(), options.dryrun.value());
break;
}
spdlog::get("app")->info("All work done!");
app.run();
return 0;
}