Skip to content

Commit

Permalink
rename extensions to include
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcisbee committed Nov 13, 2020
1 parent 8b8fe5d commit f264741
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ file file to parse; otherwise uses stdin
Options:
-v, --version print version and exit
-s, --schema validate json according to schema
-e, --extensions array of file paths to include (default: *.json)
-i, --include array of file paths to include (default: *.json)
-a, --allow rules for definitions and keys to allow (example: additionalProperties:name:MyDefinition)
```

Expand Down
15 changes: 9 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const report = require("./report");
const validate = require("./validate");

const defaultConfig = {
extensions: ["*.json"],
include: ["*.json"],
exclude: ["node_modules/**"],
};

/**
Expand All @@ -34,13 +35,15 @@ function validator() {
// Types
"--version": Boolean,
"--schema": String,
"--extensions": [String],
"--include": [String],
"--exclude": [String],
"--allow": [String],

// Aliases
"-v": "--version",
"-s": "--schema",
"-e": "--extensions",
"-i": "--include",
"-e": "--exclude",
"-a": "--allow",
});

Expand All @@ -51,8 +54,8 @@ function validator() {
}

const userConfig = {};
if (args["--extensions"]) {
userConfig.extensions = args["--extensions"];
if (args["--include"]) {
userConfig.include = args["--include"];
}

if (args["--allow"]) {
Expand Down Expand Up @@ -156,7 +159,7 @@ function validator() {
});
},
{
include: config.extensions,
include: config.include,
},
);
} catch (_) {
Expand Down

0 comments on commit f264741

Please sign in to comment.