Skip to content

Commit 68c2992

Browse files
committed
adjust #! node environment setup
1 parent 481e9f4 commit 68c2992

File tree

1 file changed

+27
-31
lines changed

1 file changed

+27
-31
lines changed

lib/cli.js

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#! /usr/bin/env node
2+
23
"use strict";
34
var program = require('commander');
45
var chalk_1 = require('chalk');
@@ -9,39 +10,34 @@ var tutorials_1 = require('./tutorials/tutorials');
910
var publish_1 = require('./publish/publish');
1011
var update_1 = require('./update/update');
1112
program
12-
.version('0.3.27')
13-
.usage('[options] <keywords>')
14-
.option('-b, --build [path/to/tutorial.md]', 'tutorial markdown file', /^.+\.md$/i)
15-
.option('-c, --create [name]', 'tutorial name')
16-
.option('-p, --publish [version]', 'publish tutorial to npm with new version number')
17-
.option('-t, --tutorials', 'list of tutorial packages')
18-
.option('-s, --search [query]', 'search for tutorial package')
19-
.option('-r, --run', 'run tutorial')
20-
.parse(process.argv);
13+
.version('0.3.27')
14+
.usage('[options] <keywords>')
15+
.option('-b, --build [path/to/tutorial.md]', 'tutorial markdown file', /^.+\.md$/i)
16+
.option('-c, --create [name]', 'tutorial name')
17+
.option('-p, --publish [version]', 'publish tutorial to npm with new version number')
18+
.option('-t, --tutorials', 'list of tutorial packages')
19+
.option('-s, --search [query]', 'search for tutorial package')
20+
.option('-r, --run', 'run tutorial')
21+
.parse(process.argv);
2122
update_1.checkForUpdate();
2223
if (program.build) {
23-
var tutorial = program.args[0] || 'tutorial/tutorial.md';
24-
var output = 'coderoad.json';
25-
process.stdout.write(chalk_1.grey("building coderoad.json for " + tutorial + "..."));
26-
build_1.default(tutorial, output);
27-
}
28-
else if (program.create) {
29-
var packageName = program.args[0];
30-
create_1.default(packageName);
31-
}
32-
else if (program.search) {
33-
var query = program.args[0];
34-
search_1.default(query);
35-
}
36-
else if (program.tutorials) {
37-
tutorials_1.default();
38-
}
39-
else if (program.publish) {
40-
var version = program.args[0];
41-
publish_1.default(version);
42-
}
43-
else {
44-
program.help();
24+
var tutorial = program.args[0] || 'tutorial/tutorial.md';
25+
var output = 'coderoad.json';
26+
process.stdout.write(chalk_1.grey("building coderoad.json for " + tutorial + "..."));
27+
build_1.default(tutorial, output);
28+
} else if (program.create) {
29+
var packageName = program.args[0];
30+
create_1.default(packageName);
31+
} else if (program.search) {
32+
var query = program.args[0];
33+
search_1.default(query);
34+
} else if (program.tutorials) {
35+
tutorials_1.default();
36+
} else if (program.publish) {
37+
var version = program.args[0];
38+
publish_1.default(version);
39+
} else {
40+
program.help();
4541
}
4642
process.stdout.write(chalk_1.green(' ✓\n'));
4743
process.exit(0);

0 commit comments

Comments
 (0)