yanglint BUGFIX features option fixes

The description was improved and should
now finally be 100% correct and either
no features are specified, when all
are enabled or if some are specified,
only those are enabled and no others.
diff --git a/tools/lint/common.c b/tools/lint/common.c
index d319410..5c5894e 100644
--- a/tools/lint/common.c
+++ b/tools/lint/common.c
@@ -108,8 +108,6 @@
 void
 get_features(struct ly_set *fset, const char *module, const char ***features)
 {
-    static const char *all_features[] = {"*", NULL};
-
     /* get features list for this module */
     for (uint32_t u = 0; u < fset->count; ++u) {
         struct schema_features *sf = (struct schema_features *)fset->objs[u];
@@ -120,8 +118,8 @@
         }
     }
 
-    /* features not set, enable all features by default */
-    *features = all_features;
+    /* features not set so disable all */
+    *features = NULL;
 }
 
 int
diff --git a/tools/lint/main_ni.c b/tools/lint/main_ni.c
index 8941f18..ace7ea0 100644
--- a/tools/lint/main_ni.c
+++ b/tools/lint/main_ni.c
@@ -152,8 +152,11 @@
             "                explicitly specified).\n\n");
 
     printf("  -F FEATURES, --features=FEATURES\n"
-            "                Features to support, default all in all implemented modules.\n"
-            "                <modname>:[<feature>,]*\n\n");
+            "                Specific module features to support in the form <module-name>:(<feature>,)*\n"
+            "                Use <feature> '*' to enable all features of a module. This option can be\n"
+            "                specified multiple times, to enable features in multiple modules. If this\n"
+            "                option is not specified, all the features in all the implemented modules\n"
+            "                are enabled.\n\n");
 
     printf("  -i, --make-implemented\n"
             "                Make the imported modules \"referenced\" from any loaded\n"
@@ -293,8 +296,7 @@
             LY_ERR ret;
             uint8_t path_unset = 1; /* flag to unset the path from the searchpaths list (if not already present) */
             char *dir, *module;
-            const char **features = NULL;
-            uint16_t ctx_opts = 0;
+            const char **features;
             struct lys_module *mod;
 
             if (parse_schema_path(argv[optind + i], &dir, &module)) {
@@ -307,12 +309,10 @@
             }
 
             /* get features list for this module */
-            get_features(&c->schema_features, module, &features);
-
-            /* set imp feature flag if all should be enabled */
             if (!c->schema_features.count) {
-                ctx_opts = LY_CTX_ENABLE_IMP_FEATURES;
-                ly_ctx_set_options(c->ctx, ctx_opts);
+                features = all_features;
+            } else {
+                get_features(&c->schema_features, module, &features);
             }
 
             /* temporary cleanup */
@@ -322,7 +322,6 @@
             /* parse module */
             ret = lys_parse(c->ctx, in, format_schema, features, &mod);
             ly_ctx_unset_searchdir_last(c->ctx, path_unset);
-            ly_ctx_unset_options(c->ctx, ctx_opts);
             ly_in_free(in, 1);
             in = NULL;
             if (ret) {
@@ -632,6 +631,11 @@
         } /* switch */
     }
 
+    /* set imp feature flag if all should be enabled */
+    if (!c->schema_features.count) {
+        options_ctx |= LY_CTX_ENABLE_IMP_FEATURES;
+    }
+
     /* libyang context */
     if (ly_ctx_new(NULL, options_ctx, &c->ctx)) {
         YLMSG_E("Unable to create libyang context.\n");