UNPKG

1.15 kBJavaScriptView Raw
1#!/usr/bin/env node
2
3'use strict';
4
5process.title = 'yesman';
6var debug = require('debug');
7var wrench = require('wrench');
8
9debug('YesMan Cli...');
10
11var commands = {
12 help : function() {
13 console.log("usage: yesman <command> [<args>]")
14 console.log("")
15 console.log(" help");
16 console.log(" init Create an empty YesMan project");
17 console.log(" start Start the YesMan server");
18
19 },
20 init : function(appName) {
21 debug('init handler');
22 appName = appName || 'yesman';
23
24 console.log('Creating yesman instance [' + appName + ']');
25
26 var appDir = __dirname + '/app';
27 var outDir = process.cwd() + '/' + appName;
28
29 wrench.copyDirSyncRecursive(appDir, outDir, {});
30
31 },
32 start : function(appPath) {
33
34 appPath = appPath || process.cwd();
35
36 var yesman = require('./exports');
37 console.log(appPath);
38 yesman.start(appPath);
39 }
40}
41
42function main() {
43 var command = process.argv[2] || 'help';
44 var args = process.argv.slice(3) || [];
45
46 debug('Command: ' + command);
47
48 var handler = commands[command];
49
50 if(!handler)
51 process.exit(1);
52
53 handler.apply(null, args);
54
55}
56
57main();
\No newline at end of file