diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-04-23 08:28:31 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-23 08:28:31 +0200 |
| commit | dab3762388278d1efadec1040a8f5c5ebd286b24 (patch) | |
| tree | 8e1fd9656a6650129c96f11ff7453f4a56b27517 /cli/CommandLine.cc | |
| parent | d53efd75ace0791a36d8cb6c2f41bca3cb6fe7f0 (diff) | |
| parent | 72f132b8fb9f2a47b0f723f4dc4eaa4fdb0c45bd (diff) | |
Merge pull request #1 from nekernel-org/dev0.0.1b
1.1.0: New BTB verison.
Diffstat (limited to 'cli/CommandLine.cc')
| -rw-r--r-- | cli/CommandLine.cc | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/cli/CommandLine.cc b/cli/CommandLine.cc index 8c93898..5c522e7 100644 --- a/cli/CommandLine.cc +++ b/cli/CommandLine.cc @@ -7,13 +7,13 @@ #include <JSONManifestBuilder.h> #include <Includes.h> -static bool kFailed = false; +static bool kFailed = false; static bool kDryRun = false; int main(int argc, char** argv) { if (argc <= 1) - return 1; + return EXIT_FAILURE; for (size_t index = 1; index < argc; ++index) { @@ -22,10 +22,10 @@ int main(int argc, char** argv) if (index_path == "-v" || index_path == "--version") { - logger::info() << "Brought to you by Amlal El Mahrouss for the NeKernel project.\n"; - logger::info() << "© 2024-2025 Amlal El Mahrouss, all rights reserved.\n"; + BTB::Logger::info() << "Brought to you by Amlal El Mahrouss for the NeKernel project.\n"; + BTB::Logger::info() << "© 2024-2025 Amlal El Mahrouss, all rights reserved.\n"; - logger::info() << "Bugs, Issues?, check out: https://github.com/amlel-el-mahrouss/btb/issues\n"; + BTB::Logger::info() << "Bugs, issues? Check out: https://github.com/nekernel-org/btb/issues\n"; return EXIT_SUCCESS; } @@ -37,19 +37,26 @@ int main(int argc, char** argv) else if (index_path == "-h" || index_path == "--help") { - logger::info() << "Usage: btb <file>\n"; + BTB::Logger::info() << "Usage: btb <file>\n"; return EXIT_SUCCESS; } + if (index_path.starts_with("-")) + { + BTB::Logger::info() << "error: unknown option '" << index_path << "'\n"; + + return EXIT_FAILURE; + } + std::thread job_build_thread([](std::string index_path) -> void { - IManifestBuilder* builder = nullptr; + BTB::IManifestBuilder* builder = nullptr; const auto kJsonExtension = ".json"; if (index_path.ends_with(kJsonExtension)) { - builder = new JSONManifestBuilder(); + builder = new BTB::JSONManifestBuilder(); if (!builder) { @@ -59,12 +66,12 @@ int main(int argc, char** argv) } else { - logger::info() << "error: file '" << index_path << "' does not end with .json!" << std::endl; + BTB::Logger::info() << "error: file '" << index_path << "' is not a JSON file!" << std::endl; kFailed = true; return; } - logger::info() << "building: " << index_path << std::endl; + BTB::Logger::info() << "building manifest: " << index_path << std::endl; if (builder && !builder->buildTarget(index_path.size(), index_path.c_str(), kDryRun)) { @@ -73,7 +80,8 @@ int main(int argc, char** argv) delete builder; builder = nullptr; - }, index_path); + }, + index_path); job_build_thread.join(); } |
