-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcli.js
More file actions
executable file
·44 lines (37 loc) · 1.05 KB
/
cli.js
File metadata and controls
executable file
·44 lines (37 loc) · 1.05 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
#!/usr/bin/env node
'use strict';
var meow = require('meow');
var _ = require('lodash');
var self = require('./');
var cli = meow([
'Usage',
'$ rsize <src> <dest (optional)>',
'',
'Options',
'--porcent image porcentage resize',
'--width new image width, (numbers or auto)',
'--height new image height, (numbers or auto)',
'--algo resize algorithm, default: bilinear',
'algorithms: bilinear | neighbor | bicubic | hermite | bezier',
'',
'Examples',
'rsize "**/*.png" "destFolder/" --porcent 50',
'rsize "**/*.png" "destFolder/" --width 100',
'rsize "**/*.png" "destFolder/" --width 100 --height 100',
'rsize "**/*.png" "destFolder/" --width 100 --height auto',
'rsize "**/*.png" "destFolder/" --porcent 25 --algo bicubic',
], {
string: ['_']
});
var defaults = {
}
var options = _.extend({},defaults,{
porcent: cli.flags.porcent,
width: cli.flags.width,
height: cli.flags.height,
algo: cli.flags.algo,
})
options = _.omitBy(options,_.isUndefined);
var glob = _.nth(cli.input,0);
var dest = _.nth(cli.input,1);
self(glob,dest,options);