|
1 | 1 | #! /usr/bin/env node |
| 2 | + |
2 | 3 | "use strict"; |
3 | 4 | var program = require('commander'); |
4 | 5 | var chalk = require('chalk'); |
5 | 6 | var build_1 = require('./src/build/build'); |
6 | 7 | var create_1 = require('./src/create/create'); |
7 | 8 | program |
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); |
| 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); |
17 | 18 | if (!program.args.length) { |
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); |
| 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); |
32 | 32 | } |
0 commit comments