Skip to content

Commit f8c2e55

Browse files
authored
Update pipeline.js
1 parent 5d42a2e commit f8c2e55

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

pipeline.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,22 @@ const getOptionDesc = function (cmdOpt, optName) {
4444

4545
var 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

5051
showBoxBanner()
5152

5253
var cmdOPS = (argv._[0] || 'create').toUpperCase()
5354
var optCMD = (argv._.length > 1 ? argv._[1] : undefined)
5455
var index = -1
55-
const filename = '.gitlab-ci'
56+
const filename = argv['file'] || '.gitlab-ci.yml'
5657
const 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')
5863
const yamlObject = YAML.parse(file)
5964
if (cmdOPS == 'CREATE') {
6065
if (!optCMD) {

0 commit comments

Comments
 (0)