summaryrefslogtreecommitdiffstats
path: root/tests/hawd/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/hawd/main.cpp')
-rw-r--r--tests/hawd/main.cpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/hawd/main.cpp b/tests/hawd/main.cpp
new file mode 100644
index 0000000..fb07b08
--- /dev/null
+++ b/tests/hawd/main.cpp
@@ -0,0 +1,56 @@
1/*
2 * Copyright (C) 2014 Aaron Seigo <aseigo@kde.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20#include <unistd.h>
21
22#include "module.h"
23
24#include <QCoreApplication>
25#include <QDebug>
26
27#include <iostream>
28
29void printHelp()
30{
31 std::cout << QCoreApplication::translate("main", "Usage of the How Are We Doing (hawd) command line tool:").toStdString() << std::endl;
32 HAWD::Module::printCommands();
33}
34
35int main(int argc, char *argv[])
36{
37 // load all modules
38 HAWD::Module::loadModules();
39 HAWD::State state;
40
41 if (!state.isValid()) {
42 exit(1);
43 }
44
45 QCoreApplication app(argc, argv);
46 app.setApplicationName("hawd");
47
48 QStringList commands = app.arguments();
49 commands.removeFirst();
50
51 if (commands.isEmpty()) {
52 printHelp();
53 }
54
55 return HAWD::Module::match(commands, state);
56}