26{
28 arser.add_argument(
"circle").help(
"Source circle file path to convert");
29 arser.add_argument(
"recipe").help(
"Target recipe file path");
30
31 try
32 {
33 arser.parse(argc, argv);
34 }
35 catch (const std::runtime_error &err)
36 {
37 std::cout << err.what() << std::endl;
39 return 255;
40 }
41
42 std::string circle_path =
arser.get<std::string>(
"circle");
43
45 std::vector<char> modelData = fileLoader.
load();
46 const circle::Model *circlemodel = circle::GetModel(modelData.data());
47 if (circlemodel == nullptr)
48 {
49 std::cerr << "ERROR: Failed to load circle '" << circle_path << "'" << std::endl;
50 return 255;
51 }
52
53
55 if (recipe.get() == nullptr)
56 {
57 std::cerr << "ERROR: Failed to generate recipe" << std::endl;
58 return 255;
59 }
60
61 std::string recipe_path =
arser.get<std::string>(
"recipe");
62
64 if (!result)
65 {
66 std::cerr << "ERROR: Failed to write to recipe '" << recipe_path << "'" << std::endl;
67 return 255;
68 }
69 return 0;
70}
DataBuffer load(void) const
std::unique_ptr< ModelRecipe > generate_recipe(const circle::Model *model)
Create ModelRecipe from circle::Model.
bool write_recipe(const std::string &filename, std::unique_ptr< ModelRecipe > &recipe)
Write ModelRecipe to file with given name.