yanglint FEATURE new option for specific input format
So that the data files do not have to have
specific extensions. Also added support for
LYB format.
diff --git a/tools/lint/common.c b/tools/lint/common.c
index 968d00f..ed28665 100644
--- a/tools/lint/common.c
+++ b/tools/lint/common.c
@@ -73,9 +73,11 @@
return -1;
}
- /* get the file format */
- if (get_format(filepath, format_schema, format_data)) {
- return -1;
+ if ((format_schema && !*format_schema) || (format_data && !*format_data)) {
+ /* get the file format */
+ if (get_format(filepath, format_schema, format_data)) {
+ return -1;
+ }
}
if (ly_in_new_filepath(filepath, 0, in)) {
@@ -310,6 +312,9 @@
} else if (!strcmp(ptr, "json")) {
informat_s = 0;
informat_d = LYD_JSON;
+ } else if (!strcmp(ptr, "lyb")) {
+ informat_s = 0;
+ informat_d = LYD_LYB;
} else {
YLMSG_E("Input file \"%s\" in an unknown format \"%s\".\n", filename, ptr);
return 0;