-
Notifications
You must be signed in to change notification settings - Fork 20
/
cli.js
46 lines (44 loc) · 1.1 KB
/
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
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env node
const yargs = require('yargs');
const pipeline = require('./index');
const argv = yargs
.alias('h', 'help')
.option('s', {
alias : 'selection',
demand: true,
describe: 'path to icomoon selection file',
})
.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;
pipeline({
selectionPath: argv.s,
icons: argv.i.toString().includes(',') ? argv.i.split(',') : [argv.i],
names: argv.n.toString().includes(',') ? argv.n.split(',') : [argv.n],
outputDir: argv.o,
forceOverride: argv.f,
visible: argv.visible,
});