|
|
@@ -13,6 +13,8 @@ |
|
|
|
#include "util/color.hpp" |
|
|
|
|
|
|
|
#include "osdialog.h" |
|
|
|
#include "argagg.hpp" |
|
|
|
|
|
|
|
#include <unistd.h> |
|
|
|
|
|
|
|
|
|
|
@@ -24,18 +26,33 @@ int main(int argc, char* argv[]) { |
|
|
|
std::string patchFile; |
|
|
|
|
|
|
|
// Parse command line arguments |
|
|
|
int c; |
|
|
|
opterr = 0; |
|
|
|
while ((c = getopt(argc, argv, "d")) != -1) { |
|
|
|
switch (c) { |
|
|
|
case 'd': { |
|
|
|
devMode = true; |
|
|
|
} break; |
|
|
|
default: break; |
|
|
|
} |
|
|
|
argagg::parser argparser {{ |
|
|
|
{ "help", {"-h", "--help"}, "shows this help message", 0}, |
|
|
|
{ "devmod", {"-d", "--devmod"}, "enable dev mode", 0}, |
|
|
|
}}; |
|
|
|
|
|
|
|
argagg::parser_results args; |
|
|
|
|
|
|
|
try { |
|
|
|
args = argparser.parse(argc, argv); |
|
|
|
} catch (const std::exception& e) { |
|
|
|
std::cerr << "Encountered exception while parsing arguments: " << e.what() << std::endl; |
|
|
|
return EXIT_FAILURE; |
|
|
|
} |
|
|
|
if (optind < argc) { |
|
|
|
patchFile = argv[optind]; |
|
|
|
|
|
|
|
if (args["help"]) { |
|
|
|
std::cerr << "Usage: program [options] [FILENAME]" << std::endl; |
|
|
|
std::cerr << argparser; |
|
|
|
return EXIT_SUCCESS; |
|
|
|
} |
|
|
|
|
|
|
|
if (args["devmod"]) { |
|
|
|
devMode = true; |
|
|
|
} |
|
|
|
|
|
|
|
// Filename as first positional argument |
|
|
|
if (args.pos.size() > 0) { |
|
|
|
patchFile = args.as<std::string>(0); |
|
|
|
} |
|
|
|
|
|
|
|
// Initialize environment |
|
|
|