yanglint BUGFIX print tree with line_length param
diff --git a/tools/lint/cmd_print.c b/tools/lint/cmd_print.c
index c1a5359..4157cc8 100644
--- a/tools/lint/cmd_print.c
+++ b/tools/lint/cmd_print.c
@@ -249,7 +249,7 @@
goto cleanup;
}
- if (lys_print_node(out, node, format, 0, options_print)) {
+ if (lys_print_node(out, node, format, line_length, options_print)) {
YLMSG_E("Unable to print schema node %s.\n", node_path);
goto cleanup;
}
diff --git a/tools/lint/main_ni.c b/tools/lint/main_ni.c
index ca4ba44..fddc6ed 100644
--- a/tools/lint/main_ni.c
+++ b/tools/lint/main_ni.c
@@ -984,7 +984,7 @@
ly_print(c.out, "%s\n", features_output);
} else if (c.schema_out_format) {
if (c.schema_node) {
- ret = lys_print_node(c.out, c.schema_node, c.schema_out_format, 0, c.schema_print_options);
+ ret = lys_print_node(c.out, c.schema_node, c.schema_out_format, c.line_length, c.schema_print_options);
if (ret) {
YLMSG_E("Unable to print schema node %s.\n", c.schema_node_path);
goto cleanup;
diff --git a/tools/lint/tests/interactive/print.test b/tools/lint/tests/interactive/print.test
index 943833f..eb36835 100644
--- a/tools/lint/tests/interactive/print.test
+++ b/tools/lint/tests/interactive/print.test
@@ -50,4 +50,10 @@
ly_cmd "print -f tree -q -P $ipv6_path" "\\+--rw address\\* \\\[ip\\\]$"
}}
+test print_tree_path_single_node_line_length {Print node in the tree format and limit row size} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ ly_cmd "load ietf-ip"
+ ly_cmd "print -f tree -L 20 -q -P $ipv6_path" "\\+--rw address\\*\r\n *\\\[ip\\\]$"
+}}
+
cleanupTests
diff --git a/tools/lint/tests/non-interactive/format.test b/tools/lint/tests/non-interactive/format.test
index e63c8b2..303a7b0 100644
--- a/tools/lint/tests/non-interactive/format.test
+++ b/tools/lint/tests/non-interactive/format.test
@@ -27,6 +27,10 @@
ly_cmd "-f tree -q -P $ipv6_path $mdir/ietf-ip.yang" "\\+--rw address\\* \\\[ip\\\]$"
} {}
+test format_tree_path_single_node_line_length {Print node in the tree format and limit row size} {
+ ly_cmd "-f tree -L 20 -q -P $ipv6_path $mdir/ietf-ip.yang" "\\+--rw address\\*\n *\\\[ip\\\]$"
+} {}
+
test format_feature_param_one_module {Show features for one module} {
ly_cmd "-f feature-param $mdir/ietf-ip.yang" " -F ietf-ip:ipv4-non-contiguous-netmasks,ipv6-privacy-autoconf" -ex
} {}