@@ -56,8 +56,7 @@ export default class Cron extends Command {
56
56
help : flags . help ( { char : 'h' } ) ,
57
57
string : flags . string ( { char : 's' , description : 'Cron expression' } ) ,
58
58
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' } ) ,
61
60
}
62
61
63
62
static args = [ { name : 'string' } ]
@@ -69,8 +68,6 @@ export default class Cron extends Command {
69
68
args . string = Utilities . getInputStringFromCmd ( this , flags , args ) // from either -s or args
70
69
args . action = this . getAction ( flags , args ) //by default let it be sha1
71
70
72
- args . command = this . getCommand ( flags , args ) //by default let it be sha1
73
-
74
71
//check params after evaluating all
75
72
this . checkParameters ( flags , args )
76
73
this . evalCron ( flags , args )
@@ -112,9 +109,9 @@ export default class Cron extends Command {
112
109
if ( args . action === Cron . DESCRIBE ) {
113
110
Logger . success ( this , cronSchedule )
114
111
} 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.` )
116
113
NodeCron . schedule ( args . string , function ( ) {
117
- shelljs . exec ( args . command )
114
+ shelljs . exec ( flags . run )
118
115
} )
119
116
}
120
117
}
@@ -128,12 +125,4 @@ export default class Cron extends Command {
128
125
Logger . error ( this , 'Invalid Or Unsupported action' )
129
126
}
130
127
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
- }
139
128
}
0 commit comments