Refactor into a oop
This commit is contained in:
41
src/main.cpp
41
src/main.cpp
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user