File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -44,17 +44,22 @@ const getOptionDesc = function (cmdOpt, optName) {
4444
4545var argv = yargs . usage ( 'simplify-pipeline create|list [stage] [options]' )
4646 . string ( 'help' ) . describe ( 'help' , 'display help for a specific command' )
47- . string ( 'project' ) . describe ( 'project' , getOptionDesc ( 'create' , 'project' ) )
47+ . string ( 'project' ) . alias ( 'p' , 'project' ) . describe ( 'project' , getOptionDesc ( 'create' , 'project' ) )
48+ . string ( 'file' ) . alias ( 'f' , 'file' ) . describe ( 'file' , getOptionDesc ( 'file' , 'file' ) )
4849 . demandCommand ( 1 ) . argv ;
4950
5051showBoxBanner ( )
5152
5253var cmdOPS = ( argv . _ [ 0 ] || 'create' ) . toUpperCase ( )
5354var optCMD = ( argv . _ . length > 1 ? argv . _ [ 1 ] : undefined )
5455var index = - 1
55- const filename = ' .gitlab-ci'
56+ const filename = argv [ 'file' ] || ' .gitlab-ci.yml '
5657const projectName = argv [ 'project' ] || '.simplify-pipeline'
57- const file = fs . readFileSync ( path . resolve ( __dirname , `${ filename } .yml` ) , 'utf8' )
58+ if ( ! fs . existsSync ( path . resolve ( `${ filename } ` ) ) ) {
59+ console . error ( path . resolve ( `${ filename } ` ) + ' not found!' )
60+ process . exit ( )
61+ }
62+ const file = fs . readFileSync ( path . resolve ( `${ filename } ` ) , 'utf8' )
5863const yamlObject = YAML . parse ( file )
5964if ( cmdOPS == 'CREATE' ) {
6065 if ( ! optCMD ) {
You can’t perform that action at this time.
0 commit comments