summaryrefslogtreecommitdiff
path: root/kel_cpp_boilerplate/c++/blueprints/main_cpp.hpp
blob: 353a0450124313c070ff8b6f4b0581d4c6177dc9 (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
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;
}
)";