summaryrefslogtreecommitdiff
path: root/kel_cpp_boilerplate/c++/blueprints/main_cpp.hpp
blob: c3bdb39ff7d4dc857c2d6276305f0a1a180c8557 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#pragma once
#include <string_view>

constexpr std::string_view main_cpp_file_path = "app/c++/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;
}
)";