mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
villas-check-config: add dump option
This commit is contained in:
parent
0835e34756
commit
bed8ef58f8
1 changed files with 12 additions and 2 deletions
|
@ -43,7 +43,8 @@ class TestConfig : public Tool {
|
|||
public:
|
||||
TestConfig(int argc, char *argv[]) :
|
||||
Tool(argc, argv, "test-config"),
|
||||
check(false)
|
||||
check(false),
|
||||
dump(false)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -56,6 +57,7 @@ protected:
|
|||
std::string uri;
|
||||
|
||||
bool check;
|
||||
bool dump;
|
||||
|
||||
void usage()
|
||||
{
|
||||
|
@ -65,6 +67,7 @@ protected:
|
|||
<< " -d LVL set debug level" << std::endl
|
||||
<< " -V show version and exit" << std::endl
|
||||
<< " -c perform plausability checks on config" << std::endl
|
||||
<< " -D dump config in JSON format" << std::endl
|
||||
<< " -h show usage and exit" << std::endl << std::endl;
|
||||
|
||||
printCopyright();
|
||||
|
@ -73,12 +76,16 @@ protected:
|
|||
void parse()
|
||||
{
|
||||
int c;
|
||||
while ((c = getopt (argc, argv, "hcV")) != -1) {
|
||||
while ((c = getopt (argc, argv, "hcVD")) != -1) {
|
||||
switch (c) {
|
||||
case 'c':
|
||||
check = true;
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
dump = true;
|
||||
break;
|
||||
|
||||
case 'V':
|
||||
printVersion();
|
||||
exit(EXIT_SUCCESS);
|
||||
|
@ -107,6 +114,9 @@ protected:
|
|||
if (check)
|
||||
sn.check();
|
||||
|
||||
if (dump)
|
||||
json_dumpf(sn.getConfig(), stdout, JSON_INDENT(2));
|
||||
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue