@@ -56,8 +56,7 @@ export default class Cron extends Command {
5656 help : flags . help ( { char : 'h' } ) ,
5757 string : flags . string ( { char : 's' , description : 'Cron expression' } ) ,
5858 describe : flags . boolean ( { char : 'd' , description : 'Describe cron expressions into human readable descriptions' } ) ,
59- run : flags . boolean ( { char : 'r' , description : 'run command using cron expression' } ) ,
60- command : flags . string ( { char : 'c' , description : 'unix command to be executed' } ) ,
59+ run : flags . string ( { char : 'r' , description : 'run command using cron expression' } ) ,
6160 }
6261
6362 static args = [ { name : 'string' } ]
@@ -69,8 +68,6 @@ export default class Cron extends Command {
6968 args . string = Utilities . getInputStringFromCmd ( this , flags , args ) // from either -s or args
7069 args . action = this . getAction ( flags , args ) //by default let it be sha1
7170
72- args . command = this . getCommand ( flags , args ) //by default let it be sha1
73-
7471 //check params after evaluating all
7572 this . checkParameters ( flags , args )
7673 this . evalCron ( flags , args )
@@ -112,9 +109,9 @@ export default class Cron extends Command {
112109 if ( args . action === Cron . DESCRIBE ) {
113110 Logger . success ( this , cronSchedule )
114111 } else if ( args . action === Cron . RUN ) {
115- Logger . success ( this , `running command ${ chalk . green ( cronSchedule ) } , use ${ chalk . yellow ( 'Ctrl+C' ) } to exit.` )
112+ Logger . success ( this , `running ${ chalk . yellow ( flags . run ) } , ${ chalk . green ( cronSchedule ) } , use ${ chalk . yellow ( 'Ctrl+C' ) } to exit.` )
116113 NodeCron . schedule ( args . string , function ( ) {
117- shelljs . exec ( args . command )
114+ shelljs . exec ( flags . run )
118115 } )
119116 }
120117 }
@@ -128,12 +125,4 @@ export default class Cron extends Command {
128125 Logger . error ( this , 'Invalid Or Unsupported action' )
129126 }
130127
131- // tslint:disable-next-line:no-unused
132- private getCommand ( flags : any , args : any ) {
133- // we only need this if actions is run
134- if ( flags . command ) // find human readable descriptions for cron
135- return flags . command
136- if ( args . action === Cron . RUN )
137- Logger . error ( this , 'Invalid Or Unsupported Command' )
138- }
139128}
0 commit comments