yanglint BUGFIX checking combination of options
... specifically for "data --xpath".
diff --git a/tools/lint/cmd_data.c b/tools/lint/cmd_data.c
index 69f94bc..945bc1d 100644
--- a/tools/lint/cmd_data.c
+++ b/tools/lint/cmd_data.c
@@ -284,6 +284,11 @@
cmd_data_help();
goto cleanup;
}
+ if (xpaths.count && (options_print & LYD_PRINT_WD_MASK)) {
+ YLMSG_E("The --default option cannot be combined with --xpath option.\n");
+ cmd_data_help();
+ goto cleanup;
+ }
if (operational && !data_type) {
YLMSG_W("Operational datastore takes effect only with RPCs/Actions/Replies/Notifications input data types.\n");
diff --git a/tools/lint/tests/interactive/data_xpath.test b/tools/lint/tests/interactive/data_xpath.test
index 25da774..398cb9f 100644
--- a/tools/lint/tests/interactive/data_xpath.test
+++ b/tools/lint/tests/interactive/data_xpath.test
@@ -42,6 +42,12 @@
ly_cmd_err "data -x /moddatanodes:dnc/wrng $data" "xpath failed"
}}
+test data_xpath_err_format {--xpath cannot be combined with --format} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ ly_cmd "load moddatanodes"
+ ly_cmd_err "data -f xml -x /moddatanodes:dnc/lf $data" "option cannot be combined"
+}}
+
test data_xpath_err_default {--xpath cannot be combined with --default} {
-setup $ly_setup -cleanup $ly_cleanup -body {
ly_cmd "load moddatanodes ietf-netconf-with-defaults"