#include // std::format #include // ftxui::{Element, hbox, vbox, text, separator, filler, etc.} #include // ftxui::{Render} #include // ftxui::{Screen, Dimension::Full} #include "src/ui/ui.hpp" #ifdef __cpp_lib_print #include // std::print #else #include // std::cout #endif #include "src/config/config.hpp" #include "src/core/system_data.hpp" #include "src/util/defs.hpp" #include "src/util/logging.hpp" #include "src/util/types.hpp" #include "include/argparse.hpp" using util::types::i32; fn main(const i32 argc, char* argv[]) -> i32 { using namespace ftxui; using os::SystemData; #ifdef _WIN32 winrt::init_apartment(); #endif argparse::ArgumentParser parser("draconis", "0.1.0"); parser .add_argument("--log-level") .help("Set the log level") .default_value("info") .choices("trace", "debug", "info", "warn", "error", "fatal"); parser .add_argument("-V", "--verbose") .help("Enable verbose logging. Alias for --log-level=debug") .flag(); try { parser.parse_args(argc, argv); } catch (const util::types::Exception& err) { #ifdef __cpp_lib_print std::println(stderr, "{}", err.what()); #else std::cerr << err.what() << '\n'; #endif std::cerr << parser; return 1; } if (parser["--verbose"] == true || parser["-v"] == true) info_log("Verbose logging enabled"); const Config& config = Config::getInstance(); const SystemData data = SystemData(config); Element document = ui::CreateUI(config, data); Screen screen = Screen::Create(Dimension::Full(), Dimension::Fit(document)); Render(screen, document); screen.Print(); #ifdef __cpp_lib_print std::println(); #else std::cout << '\n'; #endif return 0; }