@@ -7,14 +7,15 @@ import { SchedulerService } from 'src/services/scheduler-service';
77import { printJobs , validateCronExpression , validateTargetUrl } from 'src/services/scheduler-service.utils' ;
88import logger from 'src/utils/logger' ;
99import { chooseRegionIfNeeded , getRegionFromString } from 'src/utils/region' ;
10+ import { addPrefixIfNotExists } from 'src/utils/urls-builder' ;
1011import { isDefined } from 'src/utils/validations' ;
1112
1213export default class SchedulerCreate extends AuthenticatedCommand {
1314 static description = 'Create a new scheduler job for an app' ;
1415 static examples = [
15- '<%= config.bin %> <%= command.id %> -a APP_ID -s "0 * * * *" -u "/ my-endpoint"' ,
16- '<%= config.bin %> <%= command.id %> -a APP_ID -s "0 * * * *" -u "/ my-endpoint" -n "My-special-job" -d "My description"' ,
17- '<%= config.bin %> <%= command.id %> -a APP_ID -s "0 * * * *" -u "/ my-endpoint" -r 3 -b 10 -t 60' ,
16+ '<%= config.bin %> <%= command.id %> -a APP_ID -s "0 * * * *" -u "my-endpoint"' ,
17+ '<%= config.bin %> <%= command.id %> -a APP_ID -s "0 * * * *" -u "my-endpoint" -n "My-special-job" -d "My description"' ,
18+ '<%= config.bin %> <%= command.id %> -a APP_ID -s "0 * * * *" -u "my-endpoint" -r 3 -b 10 -t 60' ,
1819 ] ;
1920
2021 static flags = SchedulerCreate . serializeFlags ( SchedulerFlags ) ;
@@ -33,6 +34,7 @@ export default class SchedulerCreate extends AuthenticatedCommand {
3334 if ( ! schedule ) schedule = await PromptService . promptInput ( SchedulerMessages . schedule , true ) ;
3435 validateCronExpression ( schedule ) ;
3536 if ( ! targetUrl ) targetUrl = await PromptService . promptInput ( SchedulerMessages . targetUrl , true ) ;
37+ targetUrl = addPrefixIfNotExists ( targetUrl , '/' ) ;
3638 validateTargetUrl ( targetUrl ) ;
3739 if ( ! description ) description = await PromptService . promptInput ( SchedulerMessages . description , false , true ) ;
3840 if ( ! maxRetries ) maxRetries = await PromptService . promptInputNumber ( SchedulerMessages . maxRetries , false , true ) ;
0 commit comments