forked from Laboratoria/DEV005-md-links
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli.js
34 lines (31 loc) · 757 Bytes
/
cli.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env node
const argv = require("yargs")
.options("v", {
alias: "validate",
type: "boolean",
default: false,
describe: "Check if the link works or not.",
})
.options("s", {
alias: "stats",
type: "boolean",
default: false,
describe: "Basic statistics about the links.",
}).argv;
const { mdLinks } = require("./index");
// console.log(argv)
const input = argv._[0];
const validate = argv.validate;
const stats = argv.stats;
const objOptions = { validate, stats };
// console.log(input);
// console.log(argv);
// console.log(argv.validate);
// console.log(argv.stats);
mdLinks(input, objOptions)
.then((res) => {
return console.log(res);
})
.catch((err) => {
return console.log(err);
});