-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
executable file
·34 lines (26 loc) · 981 Bytes
/
index.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
#!/usr/bin/env node
var chalk = require('chalk');
var program = require('commander');
var sys = require('util')
var exec = require('child_process').exec;
program
.version('1.0.0')
.description('Kickstarter CLI for your static-websites with best practices. Easily extendible + modifiable!')
.usage('new [project_name] : Folder with name project_name will be created. Default project_name is goalup-kickstart-example')
program
.command('new [project_name]')
.action(function(dir) {
var folder_name = dir || 'goalup-kickstart-example';
exec('./creator.sh ' + folder_name,
function (error, stdout, stderr) {
if (error !== null) {
console.log(chalk.red.bold.underline("exec error:") + error);
} else {
stderr && console.log(chalk.red("Error: ") + stderr);
if(!stderr) {
console.log(chalk.green.bold.underline("Result:") + 'Boilerplate successfully created!');
}
}
});
})
program.parse(process.argv);