#include #include #include "mainclass.h" void printUsage() { qDebug()<<"Usage: netsouldc [options] (events|ns|users)"; qDebug()<<"\t-h, --help \t\t print this help."; qDebug()<<"\t-k, --keep \t\t keep session active if queries are provided in arguments. Exit by default."; qDebug()<<"\t-r, --responseOnly \t only print the responses, but not the info, ok and error."; qDebug()<<"\t-p, --pid file \t\t indicate the file path to write de pid."; qDebug()<<"\t-c, --color \t\t disable the colors in the info, ok and error."; } int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); MainClass m; m.setCloseOnNextQuery(qApp->argc() >= 2); QStringList cmds; for(int i = 1; i < qApp->argc(); ++i) { QString c = qApp->arguments().at(i); if(c == "-h" || c == "--help") { printUsage(); return 0; } else if(c == "-k" || c == "--keep") m.setCloseOnNextQuery(false); else if(c == "-r" || c == "--responseOnly") m.setShowOnlyResponse(true); else if(c == "-c" || c == "--color") m.setColored(false); else cmds.append(c); } m.addCommands(cmds); m.connectToDaemon(); return a.exec(); }