#include #include #include "commons.hpp" #include "Module.hpp" int main(int argc, char** argv) { bool debug_mode = false; while (true) { static struct option options[] = { {"help", no_argument, 0, 'h'}, {"debug", no_argument, 0, 'd'}, {0, 0, 0, 0} }; int opt_index = 0; int c = getopt_long(argc, argv, "h", options, &opt_index); if (c == -1) { break; } switch (c) { case 'h': { std::stringstream ss; ss << std::setw(8) << std::left; ss << "Usage: fakir " << std::endl << std::endl; ss << "[OPTIONS]" << std::endl; ss << "-h, --help" << "\t" << "show this message." << std::endl; std::cout << ss.str() << std::endl; return 0; } break; case 'd': { debug_mode = true; } break; default: break; } } std::vector sources; while (optind < argc) { sources.push_back(argv[optind]); optind++; } if (sources.size()) { fk::Module mod {sources[0]}; if (debug_mode) { mod.build(); } else { try { mod.build(); } catch(std::exception const& err) { std::cerr << err.what() << std::endl; return -1; } } } return 0; }