From: APTX Date: Thu, 12 Jan 2012 23:53:43 +0000 (+0100) Subject: Add version cli option. X-Git-Url: https://gitweb.aptx.org/?a=commitdiff_plain;h=19a4c009070c22dea2ca03a78e92daca1a090b78;p=AniAddCLI.git Add version cli option. --- diff --git a/main.cpp b/main.cpp index 34518cc..1365ff9 100644 --- a/main.cpp +++ b/main.cpp @@ -80,6 +80,7 @@ int main(int argc, char *argv[]) opts.addSection("Common options"); opts.add("help", "Print this message"); opts.alias("help", "h"); + opts.add("version", "Print version information"); // opts.add("config", "Use this config file", QxtCommandOptions::ValueRequired); // opts.alias("config", "c"); opts.add("no-config", "Do not read config file"); @@ -122,7 +123,7 @@ int main(int argc, char *argv[]) QTextStream cout(stdout, QIODevice::WriteOnly); - if (opts.count("help")) { + if (opts.count("help") || opts.count("version")) { cout << QCoreApplication::applicationName() << " v" << QCoreApplication::applicationVersion() << " by " << QCoreApplication::organizationName() << endl; cout << "Built on " __DATE__ " at " __TIME__ " with Qt" QT_VERSION_STR ", Qxt" QXT_VERSION_STR; @@ -134,6 +135,8 @@ int main(int argc, char *argv[]) if (AniDBUdpClient::revision()) cout << "AniDBUdpClient revision " << AniDBUdpClient::revision() << "." << endl; cout << "Running with Qt" << qVersion() << ", Qxt" << qxtVersion() << endl; + if (opts.count("version")) + return -1; cout << endl; opts.showUsage(); return -1;