Add command-line option handling and usage message in main function
This commit is contained in:
@@ -61,6 +61,7 @@ int main(int argc, char** argv) {
|
|||||||
vector<string> testnames;
|
vector<string> testnames;
|
||||||
|
|
||||||
int c;
|
int c;
|
||||||
|
bool no_opt = true;
|
||||||
while ((c = getopt(argc, argv, "hf:rdt:x")) != -1) {
|
while ((c = getopt(argc, argv, "hf:rdt:x")) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'h':
|
case 'h':
|
||||||
@@ -88,8 +89,19 @@ int main(int argc, char** argv) {
|
|||||||
cout << "Invalid option. Use -h for help.\n";
|
cout << "Invalid option. Use -h for help.\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
no_opt = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (no_opt == true) {
|
||||||
|
cout << "Usage: " << argv[0] << " -f <filename> [-r <truncate>] [-t <testnames>] [-h]\n";
|
||||||
|
|
||||||
|
cout << "\tOptions:\n";
|
||||||
|
cout << "\t\t-f => Specify .datalog file name\n";
|
||||||
|
cout << "\t\t-t => Specify tests to be extracted seprated by space\n";
|
||||||
|
cout << "\t\t-r => Truncate or replace generated files (default is append)\n";
|
||||||
|
cout << "\t\t-x => Exract all tests, overrides tests specified in -t\n\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
if (filename == "") {
|
if (filename == "") {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user