-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli.js
34 lines (26 loc) · 807 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
#!/usr/bin/env node
const commander = require('commander');
const MergeThemeJson = require('./index');
let baseFile = '';
let targetDir = [];
let output = 'theme.json';
// -b, --base [value]
const setBase = (value) => {
baseFile = value;
}
// -t, --target [array]
const setTargetDir = (value) => {
targetDir.push(value);
}
// -o, --output [value]
const setOutput = (value) => {
output = value;
}
commander
.version('0.0.1')
.requiredOption('-b, --base [value]', 'Specify the base json file.', setBase)
.requiredOption('-t, --target [value...]', 'Specify the target directory', setTargetDir)
.option('-o, --output [value]', 'Specify the output json file.', setOutput)
.parse(process.argv);
const mergeThemeJson = new MergeThemeJson(baseFile, targetDir, output);
mergeThemeJson.run();