fakir/src/main.cpp

57 lines
1.1 KiB
C++
Raw Normal View History

#include <iostream>
#include <getopt.h>
#include "commons.hpp"
#include "Module.hpp"
int main(int argc, char** argv)
{
while (true)
{
static struct option options[] = {
{"help", no_argument, 0, 'h'},
{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 <options> <sources>" << 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;
default: break;
}
}
std::vector<std::filesystem::path> sources;
while (optind < argc)
{
sources.push_back(argv[optind]);
optind++;
}
if (sources.size())
{
fk::Module mod {sources[0]};
mod.build();
}
return 0;
}