aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMattijs Korpershoek <mattijs.korpershoek@gmail.com>2014-03-07 16:36:18 +0100
committerMattijs Korpershoek <mattijs.korpershoek@gmail.com>2014-03-07 16:36:18 +0100
commit9cc5b2b7d242f4e94f87a393d7e851040ee88990 (patch)
treecb0cca4588d8659bb9fad7ee95b06ea70dfce1f6 /test
parent4f6fb106824cb593360268af0af6c445e7bfb07a (diff)
downloadexternal_parameter-framework-9cc5b2b7d242f4e94f87a393d7e851040ee88990.zip
external_parameter-framework-9cc5b2b7d242f4e94f87a393d7e851040ee88990.tar.gz
external_parameter-framework-9cc5b2b7d242f4e94f87a393d7e851040ee88990.tar.bz2
Implemented -h command for test-platform
For new users, it was not very clear that you had to give an .xml to the test-platform executable This patch implements -h an explicits that
Diffstat (limited to 'test')
-rw-r--r--test/test-platform/main.cpp29
1 files changed, 23 insertions, 6 deletions
diff --git a/test/test-platform/main.cpp b/test/test-platform/main.cpp
index 129224a..a3f50be 100644
--- a/test/test-platform/main.cpp
+++ b/test/test-platform/main.cpp
@@ -153,12 +153,27 @@ static bool startDaemonTestPlatform(const char *filePath, int portNumber, string
}
}
-static void usage()
+static void showUsage()
{
- cerr << "Invalid arguments: test-platform [-d] <file path> [port number, default "
+ cerr << "test-platform [-dh] <file path> [port number, default "
<< iDefaultPortNumber << "]" << endl;
}
+static void showInvalidUsage()
+{
+ cerr << "Invalid arguments: ";
+ showUsage();
+}
+
+static void showHelp()
+{
+ showUsage();
+ cerr << "<file path> must be a valid .xml file, oftenly ParameterFrameworkConfiguration.xml" << endl;
+ cerr << "Arguments:" << endl
+ << " -d starts as a deamon" << endl
+ << " -h display this help and exit" << endl;
+}
+
int main(int argc, char *argv[])
{
// Option found by call to getopt()
@@ -174,15 +189,17 @@ int main(int argc, char *argv[])
int indexFilePath = 1;
// Handle the -d option
- while ((opt = getopt(argc, argv, "d")) != -1) {
+ while ((opt = getopt(argc, argv, "dh")) != -1) {
switch (opt) {
case 'd':
isDaemon = true;
indexFilePath = 2;
break;
-
+ case 'h':
+ showHelp();
+ return 0;
default:
- usage();
+ showInvalidUsage();
return -1;
}
}
@@ -190,7 +207,7 @@ int main(int argc, char *argv[])
// Check the number of arguments
if ((argc < indexFilePath + 1) || (argc > indexFilePath + 2)) {
- usage();
+ showInvalidUsage();
return -1;
}