mirror of
https://dev.iopsys.eu/system/sysmngr.git
synced 2025-12-10 00:06:19 +01:00
Add support for displaying the schema data model with '-d' option
This commit is contained in:
parent
65e37b4b54
commit
c6bac7108b
1 changed files with 12 additions and 3 deletions
|
|
@ -42,7 +42,8 @@ static void usage(char *prog)
|
|||
fprintf(stderr, "\n");
|
||||
fprintf(stderr, "options:\n");
|
||||
fprintf(stderr, " -l <0-7> Set the loglevel\n");
|
||||
fprintf(stderr, " -h Displays this help\n");
|
||||
fprintf(stderr, " -d Display the schema data model supported by micro-service\n");
|
||||
fprintf(stderr, " -h Display this help\n");
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
|
|
@ -73,9 +74,9 @@ int main(int argc, char **argv)
|
|||
.cb = config_reload_cb,
|
||||
};
|
||||
int log_level = DEFAULT_LOG_LEVEL;
|
||||
int c = 0;
|
||||
int c = 0, dm_type = 0;
|
||||
|
||||
while ((c = getopt(argc, argv, "hl:")) != -1) {
|
||||
while ((c = getopt(argc, argv, "hdl:")) != -1) {
|
||||
switch (c) {
|
||||
case 'l':
|
||||
log_level = (int)strtod(optarg, NULL);
|
||||
|
|
@ -83,6 +84,9 @@ int main(int argc, char **argv)
|
|||
log_level = DEFAULT_LOG_LEVEL;
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
dm_type++;
|
||||
break;
|
||||
case 'h':
|
||||
usage(argv[0]);
|
||||
return EXIT_SUCCESS;
|
||||
|
|
@ -98,6 +102,11 @@ int main(int argc, char **argv)
|
|||
bbfdm_ubus_set_log_level(log_level);
|
||||
bbfdm_ubus_load_data_model(tDynamicObj);
|
||||
|
||||
if (dm_type > 0) {
|
||||
int res = bbfdm_print_data_model_schema(&bbfdm_ctx, dm_type);
|
||||
exit(res);
|
||||
}
|
||||
|
||||
openlog("sysmngr", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
|
||||
|
||||
#ifdef SYSMNGR_REBOOTS
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue