#include #include #include #include "mainscreen.h" std::expected parseArgs(int argc, char **argv) { std::vector arg_list; for(int i=1;i < argc; i++) { arg_list.push_back(argv[i]); } if (argc == 1) { return ""; } if(argc == 2) { return arg_list[0]; } else { return std::unexpected(1); } } void printHelp(int t) { if(t == 1) { std::cout << "Invalid number of arguments." << std::endl; } std::cout << "USAGE: nekodl [Search Term]" << std::endl; } int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); auto args = parseArgs(argc, argv); if(!args.has_value()) { printHelp(args.error()); return -1; } MainScreen screen(args.value()); // Set up code that uses the Qt event loop here. // Call QCoreApplication::quit() or QCoreApplication::exit() to quit the application. // A not very useful example would be including // #include // near the top of the file and calling // QTimer::singleShot(5000, &a, &QCoreApplication::quit); // which quits the application after 5 seconds. // If you do not need a running Qt event loop, remove the call // to QCoreApplication::exec() or use the Non-Qt Plain C++ Application template. return QCoreApplication::exec(); }