|
1 | 1 | #! /usr/bin/env node |
2 | | - |
3 | 2 | "use strict"; |
4 | 3 | var program = require('commander'); |
5 | 4 | var chalk = require('chalk'); |
6 | 5 | var build_1 = require('./src/build/build'); |
7 | 6 | var create_1 = require('./src/create/create'); |
8 | 7 | program |
9 | | - .version('0.0.1') |
10 | | - .usage('[options] <keywords>') |
11 | | - .option('-b, --build [tutorial.md]', 'tutorial markdown file', /^.+\.md$/i) |
12 | | - .option('-c, --create [name]', 'tutorial name') |
13 | | - .option('-p, --publish', 'publish tutorial to npm') |
14 | | - .option('-l, --list', 'list of tutorial packages') |
15 | | - .option('-s, --search [query]', 'search for tutorial package') |
16 | | - .option('-r, --run', 'run tutorial') |
17 | | - .parse(process.argv); |
| 8 | + .version('0.0.1') |
| 9 | + .usage('[options] <keywords>') |
| 10 | + .option('-b, --build [tutorial.md]', 'tutorial markdown file', /^.+\.md$/i) |
| 11 | + .option('-c, --create [name]', 'tutorial name') |
| 12 | + .option('-p, --publish', 'publish tutorial to npm') |
| 13 | + .option('-l, --list', 'list of tutorial packages') |
| 14 | + .option('-s, --search [query]', 'search for tutorial package') |
| 15 | + .option('-r, --run', 'run tutorial') |
| 16 | + .parse(process.argv); |
18 | 17 | if (!program.args.length) { |
19 | | - program.help(); |
20 | | -} else { |
21 | | - if (program.build) { |
22 | | - var tutorial = program.args[0]; |
23 | | - var output = 'coderoad.json'; |
24 | | - console.log(chalk.grey("building from " + tutorial + "...")); |
25 | | - build_1.default(tutorial, output); |
26 | | - } |
27 | | - if (program.create) { |
28 | | - var packageName = program.args[0]; |
29 | | - create_1.default(packageName); |
30 | | - } |
31 | | - process.exit(0); |
| 18 | + program.help(); |
| 19 | +} |
| 20 | +else { |
| 21 | + if (program.build) { |
| 22 | + var tutorial = program.args[0]; |
| 23 | + var output = 'coderoad.json'; |
| 24 | + console.log(chalk.grey("building from " + tutorial + "...")); |
| 25 | + build_1.default(tutorial, output); |
| 26 | + } |
| 27 | + if (program.create) { |
| 28 | + var packageName = program.args[0]; |
| 29 | + create_1.default(packageName); |
| 30 | + } |
| 31 | + process.exit(0); |
32 | 32 | } |
0 commit comments