mirror of
https://gitlab.com/etherlab.org/ethercat.git
synced 2026-09-26 03:53:47 +08:00
Added -q flag (quiet).
This commit is contained in:
+10
-3
@@ -25,6 +25,7 @@ static int slavePosition = DEFAULT_SLAVEPOSITION;
|
||||
static int domainIndex = DEFAULT_DOMAININDEX;
|
||||
static string command = DEFAULT_COMMAND;
|
||||
vector<string> commandArgs;
|
||||
static bool quiet = false;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -53,6 +54,7 @@ void printUsage()
|
||||
<< endl
|
||||
<< " or 'all' for all domains (default)."
|
||||
<< endl
|
||||
<< " --quiet -q Show less output." << endl
|
||||
<< " --help -h Show this help." << endl;
|
||||
}
|
||||
|
||||
@@ -68,12 +70,13 @@ void getOptions(int argc, char **argv)
|
||||
{"master", required_argument, NULL, 'm'},
|
||||
{"slave", required_argument, NULL, 's'},
|
||||
{"domain", required_argument, NULL, 'd'},
|
||||
{"quiet", no_argument, NULL, 'q'},
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
{}
|
||||
};
|
||||
|
||||
do {
|
||||
c = getopt_long(argc, argv, "m:s:d:h", longOptions, &optionIndex);
|
||||
c = getopt_long(argc, argv, "m:s:d:qh", longOptions, &optionIndex);
|
||||
|
||||
switch (c) {
|
||||
case 'm':
|
||||
@@ -117,6 +120,10 @@ void getOptions(int argc, char **argv)
|
||||
}
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
quiet = true;
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
case '?':
|
||||
printUsage();
|
||||
@@ -163,9 +170,9 @@ int main(int argc, char **argv)
|
||||
} else if (command == "master") {
|
||||
master.showMaster();
|
||||
} else if (command == "pdos") {
|
||||
master.listPdos(slavePosition);
|
||||
master.listPdos(slavePosition, quiet);
|
||||
} else if (command == "sdos") {
|
||||
master.listSdos(slavePosition);
|
||||
master.listSdos(slavePosition, quiet);
|
||||
} else if (command == "state") {
|
||||
master.requestStates(slavePosition, commandArgs);
|
||||
} else if (command == "xml") {
|
||||
|
||||
Reference in New Issue
Block a user