diff --git a/bin/index.js b/bin/index.js index 7759dd4..3563ee7 100644 --- a/bin/index.js +++ b/bin/index.js @@ -12,6 +12,7 @@ program .option("-i, --input ", "Input File (Local or Absolute Path). (Required: Either this or --url).") .option("-u, --url ", "Input URL") .option("-o, --output ", "Output File") + .option("-v, --version", "Display the current version.") .option("-p, --paths ", "A comma-separated, zero-spaces list of paths to keep. (Ex. /api/v1/users,/api/v1/organizations)") .option("--help", "Display all flags, commands, and descriptions."); program.parse(); @@ -19,6 +20,10 @@ if (program.opts().help) { program.help(); process.exit(0); } +if (program.opts().version) { + console.log(process.env.npm_package_version); + process.exit(0); +} const options = z .object({ input: z.string().optional(), diff --git a/package.json b/package.json index 9129afa..40e2a97 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openapi-endpoint-trimmer", - "version": "1.0.0", + "version": "1.0.2", "description": "", "main": "./bin/index.js", "bin": "./bin/index.js", @@ -82,6 +82,7 @@ "@semantic-release/commit-analyzer", "@semantic-release/release-notes-generator", "@semantic-release/changelog", + "@semantic-release/npm", [ "@semantic-release/git", { @@ -93,7 +94,7 @@ "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" } ], - "@semantic-release/npm" + "@semantic-release/github" ] } } diff --git a/src/index.ts b/src/index.ts index 1144f3f..12c1a6c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -23,6 +23,7 @@ program ) .option("-u, --url ", "Input URL") .option("-o, --output ", "Output File") + .option("-v, --version", "Display the current version.") .option( "-p, --paths ", "A comma-separated, zero-spaces list of paths to keep. (Ex. /api/v1/users,/api/v1/organizations)" @@ -35,6 +36,11 @@ if (program.opts().help) { process.exit(0); } +if (program.opts().version) { + console.log(process.env.npm_package_version); + process.exit(0); +} + const options = z .object({ input: z.string().optional(),