Skip to content

Commit 11036fb

Browse files
committed
Added version option
1 parent aa38333 commit 11036fb

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "gitlab-ci-local",
33
"main": "index.js",
4+
"version": "3.0.1",
45
"scripts": {
56
"build-linux": "pkg dist/index.js -t node12-linux-x64 -o ./bin/linux/gitlab-ci-local && gzip -c bin/linux/gitlab-ci-local > bin/linux.gz",
67
"build-macos": "pkg dist/index.js -t node12-macos-x64 -o ./bin/macos/gitlab-ci-local && gzip -c bin/macos/gitlab-ci-local > bin/macos.gz",
@@ -12,7 +13,7 @@
1213
"lint": "tslint --project .",
1314
"lint-fix": "tslint --fix --project .",
1415
"ncu": "ncu --semverLevel major -e 2",
15-
"test-yml-spec": "node -r source-map-support/register dist/index.js manual manual_job_invoked_from_cli --cwd tests/test-yml-spec",
16+
"test-yml-spec": "node -r source-map-support/register dist/index.js manual manual_job_invoked_from_cli --cwd tests/test-yml-spec --version",
1617
"test-exec-never-job": "node -r source-map-support/register dist/index.js exec never_job --cwd tests/test-yml-spec"
1718
},
1819
"bin": "dist/index.js",

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ Array.prototype.first = function() {
2222

2323
const argv = yargs.argv;
2424
const cwd = String(argv.cwd || process.cwd());
25+
yargs.alias("v", "version");
26+
yargs.version(JSON.parse(fs.readFileSync(`${cwd}/package.json`, "UTF8")).version);
2527
const m: any = argv.m;
2628
const manualArgs: string[] = [].concat(m || []);
2729

0 commit comments

Comments
 (0)