yanglint REFACTOR parsing of --format argument
diff --git a/tools/lint/cmd_data.c b/tools/lint/cmd_data.c
index 45f5e83..4e5e935 100644
--- a/tools/lint/cmd_data.c
+++ b/tools/lint/cmd_data.c
@@ -196,14 +196,7 @@
}
break;
case 'f': /* --format */
- if (!strcasecmp(optarg, "xml")) {
- yo->data_out_format = LYD_XML;
- } else if (!strcasecmp(optarg, "json")) {
- yo->data_out_format = LYD_JSON;
- } else if (!strcasecmp(optarg, "lyb")) {
- yo->data_out_format = LYD_LYB;
- } else {
- YLMSG_E("Unknown output format %s\n", optarg);
+ if (yl_opt_update_data_out_format(optarg, yo)) {
cmd_data_help_format();
return 1;
}