22"use strict" ;
33var program = require ( 'commander' ) ;
44var chalk_1 = require ( 'chalk' ) ;
5- var build_1 = require ( './build/build' ) ;
6- var create_1 = require ( './create/create' ) ;
7- var search_1 = require ( './search/search' ) ;
8- var tutorials_1 = require ( './tutorials/tutorials' ) ;
9- var publish_1 = require ( './publish/publish' ) ;
10- var update_1 = require ( './update/update' ) ;
5+ var result_1 = require ( './result' ) ;
6+ var build_1 = require ( './build' ) ;
7+ var create_1 = require ( './create' ) ;
8+ var search_1 = require ( './search' ) ;
9+ var tutorials_1 = require ( './tutorials' ) ;
10+ var publish_1 = require ( './publish' ) ;
11+ var update_1 = require ( './update' ) ;
1112program
1213 . version ( '0.6.0' )
1314 . usage ( '[options] <keywords>' )
@@ -18,16 +19,22 @@ program
1819 . option ( '-s, --search [query]' , 'search for tutorial package' )
1920 . option ( '-r, --run' , 'run tutorial' )
2021 . parse ( process . argv ) ;
21- update_1 . checkForUpdate ( ) ;
22+ update_1 . default ( ) ;
2223if ( program . build ) {
2324 var tutorial = program . args [ 0 ] || 'tutorial/tutorial.md' ;
2425 var output = 'coderoad.json' ;
2526 process . stdout . write ( chalk_1 . grey ( "building coderoad.json for " + tutorial + "..." ) ) ;
26- build_1 . default ( tutorial , output ) ;
27+ var built = build_1 . default ( tutorial , output ) ;
28+ if ( ! built ) {
29+ result_1 . fail ( ) ;
30+ }
2731}
2832else if ( program . create ) {
2933 var packageName = program . args [ 0 ] ;
30- create_1 . default ( packageName ) ;
34+ var created = create_1 . default ( packageName ) ;
35+ if ( ! created ) {
36+ result_1 . fail ( ) ;
37+ }
3138}
3239else if ( program . search ) {
3340 var query = program . args [ 0 ] ;
@@ -43,5 +50,4 @@ else if (program.publish) {
4350else {
4451 program . help ( ) ;
4552}
46- process . stdout . write ( chalk_1 . green ( ' ✓\n' ) ) ;
47- process . exit ( 0 ) ;
53+ result_1 . success ( ) ;
0 commit comments