forked from d00m-gui/perkins
/
perkins
executable file
·54 lines (47 loc) · 1.52 KB
/
perkins
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
#!/usr/bin/env node
/**
* Perkins v2.0.3 CLI by Carlos Elias
*/
var path = require('path'),
perkins = require('commander'),
core = require('./lib/core.js'),
server = require('./lib/preview.js'),
cli = require('./lib/cli.js')(),
colors = require('colors');
perkins
.version('Perkins 2.0.3'.bold)
.usage('[command] --options <dir>'.bold)
.option('-p, --port <port>', 'specify the port [8000]', Number, 8000)
.option('-m, --min', 'minifies Perkins into a css file.', false)
.option('-v, --verbose', 'output incoming requests.', false)
perkins
.command('preview [path]')
.description('This option create a Perkins Preview HTTP Server')
.action(function(dir){
if (path.existsSync(dir)) {
server.preview(dir);
cli.msg('Your preview server for '+dir+' is ready, Sir. on http://localhost:'+perkins.port);
cli.info('You want to stop the preview? press Ctrl+C');
} else {
cli.error('Sorry, Sir but '+dir+' do not exists...');
}
});
perkins
.command('setup <path>')
.description('Just relax let me take care of building a version of ... well me.')
.action(function(dir){
core.setup(dir);
});
perkins
.command('watch <path>')
.description('Watch changes on app.less and output them to out/stylesheets/style.css')
.action(function(dir) {
if (path.existsSync(dir)) {
cli.info('Start watching');
core.watch(dir);
}
else {
cli.error('Sorry, Sir but '+ dir +' does not exists');
}
});
perkins.parse(process.argv);