This repository was archived by the owner on Dec 1, 2022. It is now read-only.
forked from Yuyz0112/icomoon-cli
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcli.js
More file actions
executable file
·60 lines (56 loc) · 1.36 KB
/
cli.js
File metadata and controls
executable file
·60 lines (56 loc) · 1.36 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
const yargs = require('yargs');
const { pipeline, repository } = require('./index');
const argv = yargs
.alias('h', 'help')
.option('s', {
alias : 'selection',
demand: true,
describe: 'path to icomoon selection file',
})
.options('r', {
alias: 'repository',
default: '',
describe: 'path to repository folder. can not be combined with icon input'
})
.option('i', {
alias: 'icons',
describe: 'paths to icons need to be imported, separated by comma',
default: '',
})
.option('n', {
alias: 'names',
describe: 'rename icons, separated by comma, matched by index',
default: '',
})
.option('o', {
alias: 'output',
default: './output',
describe: 'output directory',
})
.option('f', {
alias: 'force',
default: false,
describe: 'force override current icon when icon name duplicated',
})
.option('v', {
alias: 'visible',
default: false,
describe: 'run a GUI chrome instead of headless mode',
})
.argv;
let options = {
selectionPath: argv.s,
icons: argv.i.split(','),
names: argv.n.split(','),
outputDir: argv.o,
forceOverride: argv.f,
visible: argv.visible,
};
if (argv.r) {
repository({
...options,
repositoryPath: argv.r
}).then(() => process.exit(0), () => process.exit(1));
} else {
pipeline(options).then(() => process.exit(0), () => process.exit(1));
}