-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli.js
57 lines (39 loc) · 1.07 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
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env node
'use strict';
process.title = 'yesman';
var debug = require('debug');
var wrench = require('wrench');
debug('YesMan Cli...');
var commands = {
help : function() {
console.log("usage: yesman <command> [<args>]")
console.log("")
console.log(" help");
console.log(" init Create an empty YesMan project");
console.log(" start Start the YesMan server");
},
init : function(appName) {
debug('init handler');
appName = appName || 'yesman';
console.log('Creating yesman instance [' + appName + ']');
var appDir = __dirname + '/app';
var outDir = process.cwd() + '/' + appName;
wrench.copyDirSyncRecursive(appDir, outDir, {});
},
start : function(appPath) {
appPath = appPath || process.cwd();
var yesman = require('./exports');
console.log(appPath);
yesman.start(appPath);
}
}
function main() {
var command = process.argv[2] || 'help';
var args = process.argv.slice(3) || [];
debug('Command: ' + command);
var handler = commands[command];
if(!handler)
process.exit(1);
handler.apply(null, args);
}
main();