-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommand-tool.js
More file actions
executable file
·37 lines (33 loc) · 1.11 KB
/
command-tool.js
File metadata and controls
executable file
·37 lines (33 loc) · 1.11 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
#!/usr/bin/env node
var program = require('commander');
var secureCode = require('.');
var package = require('./package.json');
var option = {
sourceDir: '',
destinationDir: '',
uglify:false,
debug: false
};
program
.version(package.version)
.usage('[options] -s <source-directory-path> Warning: By Default destination directory set as source directory path.')
.option('-s, --source <source-directory-path>', 'mention the source directory path.')
.option('-d, --destination <destination-directory-path>', 'mention destination directory path.')
.option('-u, --uglify <true/false>', 'uglification on files')
.option('-x, --debug <true/false>', 'debug mode')
.parse(process.argv);
option.sourceDir = program.source;
option.destinationDir = program.destination;
option.uglify = program.uglify;
option.debug = program.debug;
if(program.source){
secureCode(option,function(err,result){
if(err){
throw err;
}else{
console.log(result);
}
})
}else{
console.log('\nArgument missing, Try command: `code-protect -h` to get more help\n');
}