-
Notifications
You must be signed in to change notification settings - Fork 0
/
cxxplug_gen_interface.cpp
57 lines (46 loc) · 1.41 KB
/
cxxplug_gen_interface.cpp
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <iostream>
#include <fstream>
#include <filesystem>
#include <optional>
#include <string>
#include "common/parse_config.hpp"
#include "cxxplug_gen_interface/args.hpp"
#include "cxxplug_gen_interface/get_filepath.hpp"
#include "cxxplug_gen_interface/gen_interface.hpp"
using namespace std;
int main (int argc, char **argv) {
bool is_verbose = false;
const char *output_dir_or_file_name = "./";
if (
Args::is_argv_wrong(argc, argv, &output_dir_or_file_name, &is_verbose)
) {
cout << Args::get_help();
return -1;
};
Args args(argv + is_verbose, output_dir_or_file_name, is_verbose);
if (args.verbose) {
args.print();
}
try {
Parsed config_file_data = Parsed::get_parsed_config(
args.config_file_path
);
if (args.verbose) {
config_file_data.print();
}
string interface_filepath = get_interface_filepath(
config_file_data, args.output_dir_or_file_name
);
gen_interface(interface_filepath, config_file_data);
cout << interface_filepath;
}
catch (const fstream::failure &e) {
cerr << "Could not proceed file: " << e.what() << "\n";
return -1;
}
catch (const filesystem::filesystem_error &e) {
cerr << "Could not proceed filesystem operations: " << e.what() << "\n";
return -1;
}
return 0;
}