forked from mqnguyen5/mini-ssg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmini-ssg.js
33 lines (30 loc) · 983 Bytes
/
mini-ssg.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
const yargs = require("yargs");
const { hideBin } = require("yargs/helpers");
const tool = require("./package.json");
const processInput = require("./utils/processInput");
/**
* Creates CLI with the following options:
* -i or --input: specifies a path to a file/directory
* -h or --help: displays the tool's instructions, cmd line flags and arguments
* -v or --version: displays the tool's current version
* -s or --stylesheet: specfies a URL to a CSS stylesheet
*/
const argv = yargs(hideBin(process.argv))
.help("h")
.alias("h", "help")
.version(`${tool.name} v${tool.version}`)
.alias("v", "version")
.options({
i: {
alias: "input",
demandOption: true,
desc: "Path to file/folder",
type: "array",
},
s: {
alias: "stylesheet",
desc: "Stylesheet URL",
type: "string",
},
}).argv;
processInput(argv.input.join(" "), argv.stylesheet);