File tree 1 file changed +24
-4
lines changed
1 file changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,19 @@ app.use(flatiron.plugins.cli, {
74
74
usage : help
75
75
} ) ;
76
76
77
+ var actions = [
78
+ 'start' ,
79
+ 'stop' ,
80
+ 'restart' ,
81
+ 'list' ,
82
+ 'config' ,
83
+ 'set' ,
84
+ 'clear' ,
85
+ 'logs' ,
86
+ 'columns' ,
87
+ 'cleanlogs'
88
+ ] ;
89
+
77
90
var argvOptions = cli . argvOptions = {
78
91
'command' : { alias : 'c' } ,
79
92
'errFile' : { alias : 'e' } ,
@@ -453,22 +466,29 @@ app.cmd('help', cli.help = function () {
453
466
// Remark: this regex matches everything. It has to be added at the end to
454
467
// make executing other commands possible.
455
468
//
456
- app . cmd ( / ( . * ) / , cli . start = function ( ) {
457
- var file = require ( 'optimist' ) . argv . _ [ 0 ] ,
469
+ cli . run = function ( ) {
470
+ var file = app . argv . _ [ 0 ] ,
458
471
options = getOptions ( file ) ;
472
+
459
473
tryStart ( file , options , function ( ) {
460
474
var monitor = forever . start ( file , options ) ;
461
475
monitor . on ( 'start' , function ( ) {
462
476
forever . startServer ( monitor ) ;
463
477
} ) ;
464
478
} ) ;
465
- } ) ;
479
+ } ;
466
480
467
481
cli . start = function ( ) {
468
482
if ( app . config . get ( 'help' ) ) {
469
483
return util . puts ( help . join ( '\n' ) ) ;
470
484
}
471
485
472
- app . init ( app . start ) ;
486
+ app . init ( function ( ) {
487
+ if ( actions . indexOf ( app . argv . _ [ 0 ] ) === - 1 ) {
488
+ return cli . run ( ) ;
489
+ }
490
+
491
+ app . start ( ) ;
492
+ } ) ;
473
493
} ;
474
494
You can’t perform that action at this time.
0 commit comments