Added "version", "help" and "clean" args.

This commit is contained in:
2026-05-07 15:32:06 +02:00
parent af1519b736
commit 6584a6f0e4
3 changed files with 46 additions and 5 deletions

View File

@@ -1,7 +1,11 @@
#include "Output.hpp" #include "Output.hpp"
#include <cstdint>
#include <filesystem>
#include "fmt/base.h" #include "fmt/base.h"
#include "fmt/color.h" #include "fmt/color.h"
#include <cstdlib>
namespace Output { namespace Output {
void printMenu() { void printMenu() {
@@ -22,14 +26,32 @@ namespace Output {
fmt::print(fmt::fg(fmt::color::light_coral), fmt::print(fmt::fg(fmt::color::light_coral),
" install Run cmake --install. Needs admin privileges.\n" " 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" " 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" " help Show help.\n"
); );
fmt::print(fmt::fg(fmt::color::light_green), fmt::print(fmt::fg(fmt::color::light_green),
" version Current cmkr version.\n" " 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");
}
} }

View File

@@ -2,4 +2,6 @@
namespace Output { namespace Output {
void printMenu(); void printMenu();
void printArgClean();
void printArgVersion();
} }

View File

@@ -1,12 +1,29 @@
#include <string_view>
#include "Output.hpp" #include "Output.hpp"
// #include <iostream> #include "fmt/base.h"
// #include <cstdlib>
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
// fmt::print("Amount of args: {}\n", argc); // fmt::print("Amount of args: {}\n", argc);
// for (int i = 0; i < argc; i++) { // for (int i = 0; i < argc; i++) {
// fmt::print("argv{}: {}\n", i, argv[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(); Output::printMenu();
} }
if (std::string_view(argv[1]) == "version") {
Output::printArgVersion();
}
}