summaryrefslogtreecommitdiff
path: root/kel_cpp_boilerplate/c++/blueprints/main_cpp.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'kel_cpp_boilerplate/c++/blueprints/main_cpp.hpp')
-rw-r--r--kel_cpp_boilerplate/c++/blueprints/main_cpp.hpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/kel_cpp_boilerplate/c++/blueprints/main_cpp.hpp b/kel_cpp_boilerplate/c++/blueprints/main_cpp.hpp
new file mode 100644
index 0000000..353a045
--- /dev/null
+++ b/kel_cpp_boilerplate/c++/blueprints/main_cpp.hpp
@@ -0,0 +1,36 @@
+#pragma once
+#include <string_view>
+
+constexpr std::string_view main_cpp_dir_name = "app/c++";
+constexpr std::string_view main_cpp_file_name = "main.cpp";
+
+constexpr std::string_view main_cpp_file_content = R"(
+#include <forstio/error.hpp>
+#include <iostream>
+
+namespace kel {
+saw::error_or<void> kel_main(int argc, char** argv){
+ (void) argc;
+ (void) argv;
+ return saw::make_void();
+}
+}
+
+int main(int argc, char** argv){
+ auto eov = kel::kel_main(argc, argv);
+ if(eov.is_error()){
+ auto& err = eov.get_error();
+ auto err_msg = err.get_message();
+ std::cerr<<"[Error]: "<<err.get_category();
+
+ if(not err_msg.empty()){
+ std::cerr<<" - "<<err_msg;
+ }
+ std::cerr<<std::endl;
+
+ return err.get_id();
+ }
+
+ return 0;
+}
+)";