yanglint FEATURE --extended-leafref for add, load

... commands in interactive mode.
diff --git a/tools/lint/cmd.c b/tools/lint/cmd.c
index 3a7fba3..cefd657 100644
--- a/tools/lint/cmd.c
+++ b/tools/lint/cmd.c
@@ -254,8 +254,8 @@
 /* Also keep enum COMMAND_INDEX updated. */
 COMMAND commands[] = {
     {"help", cmd_help, cmd_help_help, NULL, "Display commands description", "h"},
-    {"add", cmd_add, cmd_add_help, NULL, "Add a new module from a specific file", "DF:hi"},
-    {"load", cmd_load, cmd_load_help, NULL, "Load a new schema from the searchdirs", "F:hi"},
+    {"add", cmd_add, cmd_add_help, NULL, "Add a new module from a specific file", "DF:hiX"},
+    {"load", cmd_load, cmd_load_help, NULL, "Load a new schema from the searchdirs", "F:hiX"},
     {"print", cmd_print, cmd_print_help, NULL, "Print a module", "f:hL:o:P:q"},
     {"data", cmd_data, cmd_data_help, NULL, "Load, validate and optionally print instance data", "d:ef:F:hmo:O:R:r:nt:x:"},
     {"list", cmd_list, cmd_list_help, NULL, "List all the loaded modules", "f:h"},
diff --git a/tools/lint/cmd_add.c b/tools/lint/cmd_add.c
index aa78156..37bf78c 100644
--- a/tools/lint/cmd_add.c
+++ b/tools/lint/cmd_add.c
@@ -43,7 +43,9 @@
             "  -i, --make-implemented\n"
             "                  Make the imported modules \"referenced\" from any loaded\n"
             "                  <schema> module also implemented. If specified a second time,\n"
-            "                  all the modules are set implemented.\n");
+            "                  all the modules are set implemented.\n"
+            "  -X, --extended-leafref\n"
+            "                  Allow usage of deref() XPath function within leafref.\n");
 }
 
 void
@@ -57,6 +59,7 @@
         {"features", required_argument, NULL, 'F'},
         {"help", no_argument, NULL, 'h'},
         {"make-implemented", no_argument, NULL, 'i'},
+        {"extended-leafref", no_argument, NULL, 'X'},
         {NULL, 0, NULL, 0}
     };
     uint16_t options_ctx = 0;
@@ -100,6 +103,10 @@
             }
             break;
 
+        case 'X': /* --extended-leafref */
+            options_ctx |= LY_CTX_LEAFREF_EXTENDED;
+            break;
+
         default:
             YLMSG_E("Unknown option.\n");
             goto cleanup;
diff --git a/tools/lint/cmd_load.c b/tools/lint/cmd_load.c
index 488293e..797167c 100644
--- a/tools/lint/cmd_load.c
+++ b/tools/lint/cmd_load.c
@@ -39,7 +39,9 @@
             "  -i, --make-implemented\n"
             "                  Make the imported modules \"referenced\" from any loaded\n"
             "                  <schema> module also implemented. If specified a second time,\n"
-            "                  all the modules are set implemented.\n");
+            "                  all the modules are set implemented.\n"
+            "  -X, --extended-leafref\n"
+            "                  Allow usage of deref() XPath function within leafref.\n");
 }
 
 void
@@ -52,6 +54,7 @@
         {"features", required_argument, NULL, 'F'},
         {"help", no_argument, NULL, 'h'},
         {"make-implemented", no_argument, NULL, 'i'},
+        {"extended-leafref", no_argument, NULL, 'X'},
         {NULL, 0, NULL, 0}
     };
     uint16_t options_ctx = 0;
@@ -83,6 +86,10 @@
             }
             break;
 
+        case 'X': /* --extended-leafref */
+            options_ctx |= LY_CTX_LEAFREF_EXTENDED;
+            break;
+
         default:
             YLMSG_E("Unknown option.\n");
             goto cleanup;
diff --git a/tools/lint/tests/interactive/add.test b/tools/lint/tests/interactive/add.test
index 85d36bb..d1cacc1 100644
--- a/tools/lint/tests/interactive/add.test
+++ b/tools/lint/tests/interactive/add.test
@@ -46,4 +46,14 @@
     ly_cmd "list" "I modimp-type\r.*I modtypedef"
 }}
 
+test add_extended_leafref_enabled {Valid module with --extended-leafref option} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+    ly_cmd "add -X $mdir/modextleafref.yang"
+}}
+
+test add_extended_leafref_disabled {Expected error if --extended-leafref is not set} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+    ly_cmd_err "add $mdir/modextleafref.yang" "Unexpected XPath token \"FunctionName\""
+}}
+
 cleanupTests
diff --git a/tools/lint/tests/interactive/load.test b/tools/lint/tests/interactive/load.test
index 382b9e9..a95d044 100644
--- a/tools/lint/tests/interactive/load.test
+++ b/tools/lint/tests/interactive/load.test
@@ -32,4 +32,14 @@
     ly_cmd "list" "I modimp-type\r.*I modtypedef"
 }}
 
+test load_extended_leafref_enabled {Valid module with --extended-leafref option} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+    ly_cmd "load -X modextleafref"
+}}
+
+test load_extended_leafref_disabled {Expected error if --extended-leafref is not set} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+    ly_cmd_err "load modextleafref" "Unexpected XPath token \"FunctionName\""
+}}
+
 cleanupTests