From b491f039cee6e585ca4e1dd5d4144e474da8acdf Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Fri, 28 Mar 2025 21:06:13 +0100 Subject: vendor: add: Use rang library now. cli: fix: always check if builder has been allocated after (presumably) allocating one. Signed-off-by: Amlal El Mahrouss --- cli/CommandLine.cc | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'cli/CommandLine.cc') diff --git a/cli/CommandLine.cc b/cli/CommandLine.cc index aedefff..8c93898 100644 --- a/cli/CommandLine.cc +++ b/cli/CommandLine.cc @@ -22,11 +22,10 @@ int main(int argc, char** argv) if (index_path == "-v" || index_path == "--version") { - std::cout << "Usage: btb \n"; - std::cout << "Bugs, Issues?, check out: https://github.com/amlel-el-mahrouss/btb/issues\n"; + 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"; - std::cout << "Brought to you by Amlal El Mahrouss for the NeKernel project.\n"; - std::cout << "© 2024-2025 Amlal El Mahrouss, all rights reserved.\n"; + logger::info() << "Bugs, Issues?, check out: https://github.com/amlel-el-mahrouss/btb/issues\n"; return EXIT_SUCCESS; } @@ -38,7 +37,8 @@ int main(int argc, char** argv) else if (index_path == "-h" || index_path == "--help") { - std::cout << "btb: Build a JSON file: btb .json\n"; + logger::info() << "Usage: btb \n"; + return EXIT_SUCCESS; } @@ -50,24 +50,26 @@ int main(int argc, char** argv) if (index_path.ends_with(kJsonExtension)) { builder = new JSONManifestBuilder(); + + if (!builder) + { + kFailed = true; + return; + } } else { - std::cout << "btb: error: file '" << index_path << "' does not end with .json!" << std::endl; + logger::info() << "error: file '" << index_path << "' does not end with .json!" << std::endl; kFailed = true; return; } - std::cout << "btb: building: " << index_path << std::endl; + logger::info() << "building: " << index_path << std::endl; if (builder && !builder->buildTarget(index_path.size(), index_path.c_str(), kDryRun)) { kFailed = true; } - else if (!builder) - { - kFailed = true; - } delete builder; builder = nullptr; -- cgit v1.2.3