diff --git a/meson.build b/meson.build index b29c097..d14fcdd 100644 --- a/meson.build +++ b/meson.build @@ -105,21 +105,21 @@ add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : executable( 'cachyos-installer', src_files, - dependencies: [fmt, spdlog, ftxui, cpr, glibmm], + dependencies: [fmt, spdlog, ftxui, simdjson, cpr, glibmm], include_directories: [include_directories('src')], install: true) executable( 'test-exec-interactive', files('src/config.cpp', 'src/tui.cpp', 'src/utils.cpp', 'src/main_test.cpp'), - dependencies: [fmt, spdlog, ftxui, cpr, glibmm], + dependencies: [fmt, spdlog, ftxui, simdjson, cpr, glibmm], include_directories: [include_directories('src')], install: false) executable( 'test-process-tailing', files('src/config.cpp', 'src/widgets.cpp', 'src/tui.cpp', 'src/utils.cpp', 'src/follow_process_log.cpp','src/test_proccess_tailing.cpp'), - dependencies: [fmt, spdlog, ftxui, cpr, glibmm], + dependencies: [fmt, spdlog, ftxui, simdjson, cpr, glibmm], include_directories: [include_directories('src')], install: false) diff --git a/src/main.cpp b/src/main.cpp index 2955122..bf80234 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -25,6 +25,8 @@ int main() { return 1; } + utils::parse_config(); + if (!Config::initialize()) { return 1; } diff --git a/src/utils.cpp b/src/utils.cpp index 8e2504a..9614ae3 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -46,6 +46,23 @@ namespace ranges = std::ranges; #include #endif +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wsign-conversion" +#elif defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wuseless-cast" +#endif + +#include + +#if defined(__clang__) +#pragma clang diagnostic pop +#elif defined(__GNUC__) +#pragma GCC diagnostic pop +#endif + namespace fs = std::filesystem; namespace utils { @@ -465,4 +482,18 @@ void show_iwctl() noexcept { } } +void parse_config() noexcept { + using namespace simdjson; + + ondemand::parser parser; + padded_string json = padded_string::load("test.json"); + ondemand::document doc = parser.iterate(json); + + for (auto entry : doc["steps"]) { + std::string_view step; + entry.get(step); + std::cout << step << '\n'; + } +} + } // namespace utils diff --git a/src/utils.hpp b/src/utils.hpp index 1ad5697..85e8d68 100644 --- a/src/utils.hpp +++ b/src/utils.hpp @@ -34,6 +34,8 @@ void id_system() noexcept; [[nodiscard]] bool handle_connection() noexcept; void show_iwctl() noexcept; +void parse_config() noexcept; + template ::is_integer>> inline T to_int(const std::string_view& str) { diff --git a/test.json b/test.json new file mode 100644 index 0000000..d5d07f2 --- /dev/null +++ b/test.json @@ -0,0 +1,3 @@ +{ + "steps": ["locale", "partitions_encryption", "keyboard", "users", "summary", "netinstall", "finish"] +}