Added "version", "help" and "clean" args.
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
#include "Output.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <filesystem>
|
||||
|
||||
#include "fmt/base.h"
|
||||
#include "fmt/color.h"
|
||||
#include <cstdlib>
|
||||
|
||||
namespace Output {
|
||||
void printMenu() {
|
||||
@@ -22,14 +26,32 @@ namespace Output {
|
||||
fmt::print(fmt::fg(fmt::color::light_coral),
|
||||
" install Run cmake --install. Needs admin privileges.\n"
|
||||
);
|
||||
fmt::print(fmt::fg(fmt::color::light_coral),
|
||||
fmt::print(fmt::fg(fmt::color::light_green),
|
||||
" clean Clean the build directory.\n"
|
||||
);
|
||||
fmt::print(fmt::fg(fmt::color::light_coral),
|
||||
fmt::print(fmt::fg(fmt::color::light_green),
|
||||
" help Show help.\n"
|
||||
);
|
||||
fmt::print(fmt::fg(fmt::color::light_green),
|
||||
" version Current cmkr version.\n"
|
||||
);
|
||||
}
|
||||
|
||||
void printArgClean() {
|
||||
std::filesystem::path dirPath = "build";
|
||||
|
||||
if (!std::filesystem::exists(dirPath) || !std::filesystem::is_directory(dirPath)) return;
|
||||
|
||||
for (const auto& entry : std::filesystem::directory_iterator(dirPath)) {
|
||||
std::filesystem::remove_all(entry.path());
|
||||
}
|
||||
|
||||
fmt::print(fmt::fg(fmt::color::light_green),
|
||||
"[Lazymake] Cleaned up build directory!\n"
|
||||
);
|
||||
}
|
||||
|
||||
void printArgVersion() {
|
||||
fmt::print("Version: 0.0.1 (Early pre-pre-pre-pre alpha\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,4 +2,6 @@
|
||||
|
||||
namespace Output {
|
||||
void printMenu();
|
||||
void printArgClean();
|
||||
void printArgVersion();
|
||||
}
|
||||
|
||||
21
src/main.cpp
21
src/main.cpp
@@ -1,12 +1,29 @@
|
||||
#include <string_view>
|
||||
|
||||
#include "Output.hpp"
|
||||
// #include <iostream>
|
||||
// #include <cstdlib>
|
||||
#include "fmt/base.h"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
// fmt::print("Amount of args: {}\n", argc);
|
||||
|
||||
// for (int i = 0; i < argc; i++) {
|
||||
// fmt::print("argv{}: {}\n", i, argv[i]);
|
||||
// }
|
||||
|
||||
if (argc == 1) {
|
||||
Output::printMenu();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (std::string_view(argv[1]) == "clean") {
|
||||
Output::printArgClean();
|
||||
}
|
||||
|
||||
if (std::string_view(argv[1]) == "help") {
|
||||
Output::printMenu();
|
||||
}
|
||||
|
||||
if (std::string_view(argv[1]) == "version") {
|
||||
Output::printArgVersion();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user