From 399d0a9a02d4a993b20637bebfba22f4c33aff04 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Mon, 6 May 2024 14:36:55 +0200 Subject: Reworking the cli manipulator a little bit --- modules/tools/c++/cli_analyzer.hpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'modules/tools/c++/cli_analyzer.hpp') diff --git a/modules/tools/c++/cli_analyzer.hpp b/modules/tools/c++/cli_analyzer.hpp index 6b44987..8142e2a 100644 --- a/modules/tools/c++/cli_analyzer.hpp +++ b/modules/tools/c++/cli_analyzer.hpp @@ -14,6 +14,7 @@ namespace impl { struct cli_mode { struct read {}; struct write {}; + struct list {}; }; template @@ -167,7 +168,7 @@ struct parsed_args { }; template -error_or modify_data_on_cli(bool read_mode, const std::string_view& file_path, std::deque sch_path, std::string& json_data){ +error_or modify_data_on_cli(const std::string_view& mode, const std::string_view& file_path, std::deque sch_path, std::string& json_data){ /** * Read data from file */ @@ -194,14 +195,14 @@ error_or modify_data_on_cli(bool read_mode, const std::string_view& file_p } } - if (read_mode) { + if (mode == "r") { { auto eov = impl::cli_traverser>::template traverse(sch_path, native_data, json_data); if(eov.is_error()){ return eov; } } - } else { + } else if (mode == "w") { { auto eov = impl::cli_traverser>::template traverse(sch_path, native_data, json_data); if(eov.is_error()){ @@ -225,6 +226,11 @@ error_or modify_data_on_cli(bool read_mode, const std::string_view& file_p fstr << enc_str; fstr.close(); } + } else if (mode == "l"){ + { + } + }else{ + return make_error("Invalid mode"); } return void_t{}; -- cgit v1.2.3