[add] conf-schema exposition
This commit is contained in:
parent
196ee61fd9
commit
c23175163b
|
@ -652,8 +652,8 @@ namespace _munin.conf
|
|||
|
||||
/**
|
||||
*/
|
||||
function schema(
|
||||
version : string
|
||||
export function schema(
|
||||
version : string = "3"
|
||||
) : lib_plankton.conf.type_schema
|
||||
{
|
||||
switch (version) {
|
||||
|
@ -679,7 +679,6 @@ namespace _munin.conf
|
|||
};
|
||||
break;
|
||||
}
|
||||
default:
|
||||
case "2":
|
||||
case "3": {
|
||||
return {
|
||||
|
|
|
@ -176,6 +176,15 @@ namespace _munin
|
|||
"info": "path to configuration file",
|
||||
"name": "conf-path",
|
||||
}),
|
||||
"conf_schema": lib_plankton.args.class_argument.volatile({
|
||||
"indicators_long": ["conf-schema"],
|
||||
"indicators_short": ["s"],
|
||||
"type": lib_plankton.args.enum_type.string,
|
||||
"mode": lib_plankton.args.enum_mode.replace,
|
||||
"default": "",
|
||||
"info": "only print the configuration schema in a specific version (latest version via argument '_')",
|
||||
"name": "conf-schema",
|
||||
}),
|
||||
"conf_expose": lib_plankton.args.class_argument.volatile({
|
||||
"indicators_long": ["conf-expose"],
|
||||
"indicators_short": ["e"],
|
||||
|
@ -187,11 +196,11 @@ namespace _munin
|
|||
}),
|
||||
"single_run": lib_plankton.args.class_argument.volatile({
|
||||
"indicators_long": ["single-run"],
|
||||
"indicators_short": ["s"],
|
||||
"indicators_short": ["x"],
|
||||
"type": lib_plankton.args.enum_type.boolean,
|
||||
"mode": lib_plankton.args.enum_mode.replace,
|
||||
"default": false,
|
||||
"info": "whether to only execute on iteration at run",
|
||||
"info": "whether to only execute one iteration at run",
|
||||
"name": "single-run",
|
||||
}),
|
||||
"verbosity": lib_plankton.args.class_argument.volatile({
|
||||
|
@ -239,6 +248,19 @@ namespace _munin
|
|||
)
|
||||
);
|
||||
}
|
||||
else {
|
||||
if (args.conf_schema !== "") {
|
||||
process.stdout.write(
|
||||
lib_plankton.json.encode(
|
||||
_munin.conf.schema((args.conf_schema === "_") ? undefined : args.conf_schema),
|
||||
{
|
||||
"formatted": true,
|
||||
}
|
||||
)
|
||||
+
|
||||
"\n"
|
||||
);
|
||||
}
|
||||
else {
|
||||
// init
|
||||
const conf : _munin.conf.type_conf = await _munin.conf.load(args.conf_path);
|
||||
|
@ -305,6 +327,7 @@ namespace _munin
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Promise.resolve<void>(undefined);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue