1 | #! /usr/bin/env node
|
2 |
|
3 | var program = require('commander'),
|
4 | create = require('../lib/create'),
|
5 | pack = require('../lib/pack');
|
6 |
|
7 | program
|
8 | .version(require('../package.json').version)
|
9 | .command('<create>', 'Create the HTML/CSS/JS template for electron in your current directory.')
|
10 | .command('<pack> [dir]', 'Build and pack the src into native app. <dir> is the path/directory for the src files.')
|
11 | .parse(process.argv);
|
12 |
|
13 | var command = program.args[0];
|
14 | var pname = program.args[1];
|
15 |
|
16 | if (!command) {
|
17 | console.error('Command not found.');
|
18 | program.help();
|
19 | } else {
|
20 | if (command === 'create') {
|
21 | create(pname);
|
22 | } else if (command === 'pack') {
|
23 | if (!pname) {
|
24 | console.error('Target dir not found.');
|
25 | program.help();
|
26 | } else {
|
27 | pack(pname);
|
28 | }
|
29 | } else {
|
30 | console.error('Command not found. Type "2app -h" to get more infos.');
|
31 | }
|
32 | }
|
33 |
|
34 |
|