MCPcopy Create free account
hub / github.com/Dobiasd/FunctionalPlus / main

Function main

api_search/parse_source_files.cpp:186–222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184}
185
186int main(int argc, char* argv[])
187{
188 if (argc != 2) {
189 std::cerr << "Provide code file via command line." << std::endl;
190 return 1;
191 }
192
193 const auto functions = fplus::sort_on(get_function_help_name,
194 parse_code_file(std::string(argv[1])));
195 const auto broken = get_broken_function_helps(functions);
196 std::cout << "broken:" << std::endl;
197 if (fplus::is_not_empty(broken)) {
198 std::cout << fplus::show_cont_with_frame_and_newlines(
199 "\n-----\n", "[", "]",
200 get_broken_function_helps(functions),
201 0) << std::endl;
202 return 1;
203 }
204 std::cout << "---" << std::endl;
205
206 using fplus::transform;
207 std::cout << "duplicate help names:" << std::endl;
208 print_duplicates(transform(get_function_help_name, functions));
209 // print_duplicates(transform(get_function_help_signature, functions));
210 std::cout << "duplicate help documentations:" << std::endl;
211 print_duplicates(transform(get_function_help_documentation, functions));
212 std::cout << "duplicate help declarations:" << std::endl;
213 print_duplicates(transform(get_function_help_declaration, functions));
214
215 auto output = functions_to_elm_code(functions);
216 std::string out_file = "frontend/src/Database.elm";
217 if (fplus::write_text_file(out_file, output)()) {
218 std::cout << out_file << " written." << std::endl;
219 } else {
220 std::cerr << "Error: Unable to write " << out_file << std::endl;
221 }
222}

Callers

nothing calls this directly

Calls 9

parse_code_fileFunction · 0.85
print_duplicatesFunction · 0.85
functions_to_elm_codeFunction · 0.85
sort_onFunction · 0.50
is_not_emptyFunction · 0.50
transformFunction · 0.50
write_text_fileFunction · 0.50

Tested by

no test coverage detected