output: add mustach templating support

Based on José Bollo's mustache C implementation.  This adaptation uses
project specific data structures to avoid overhead with json parsing.

Reference: https://gitlab.com/jobol/mustach.git
Commit: d84608a69033d38c81b8fcff0cb272e225dd5428
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2017-11-09 09:49:26 +00:00
parent fe847bb9b1
commit 7d9a5b5561
No known key found for this signature in database
GPG key ID: A9553245FDE9B739
9 changed files with 741 additions and 6 deletions

View file

@ -112,7 +112,8 @@ int main(int argc, char **argv)
OPT_CRIT_COUNT,
OPT_COLOR,
OPT_SKIP_OK,
OPT_SET_IPV
OPT_SET_IPV,
OPT_MUSTACH
};
int ret_val;
@ -126,6 +127,7 @@ int main(int argc, char **argv)
{"reverse", no_argument, NULL, 'r'},
{"output", required_argument, NULL, 'o'},
{"limit", required_argument, NULL, 'L'},
{"mustach", required_argument, NULL, OPT_MUSTACH},
{"version", no_argument, NULL, 'v'},
{"help", no_argument, NULL, 'h'},
{"snet-alarms", no_argument, NULL, OPT_SNET_ALARMS},
@ -225,6 +227,10 @@ int main(int argc, char **argv)
config.header_limit = return_limit(optarg[0]);
config.number_limit = return_limit(optarg[1]);
break;
case OPT_MUSTACH:
config.mustach_template = optarg;
output_format = 'm';
break;
case OPT_COLOR:
config.color_mode = parse_color_mode(optarg);
if (config.color_mode == color_unknown)