From e675e432f8c55b303072fc6da2ddab3eaae7969e Mon Sep 17 00:00:00 2001 From: Kevin Longmuir Date: Thu, 5 Mar 2026 16:30:20 -0500 Subject: [PATCH 1/2] fix: version flag when running with no args --- bin/main.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/main.js b/bin/main.js index 7bb76759..e5147c52 100644 --- a/bin/main.js +++ b/bin/main.js @@ -2,13 +2,16 @@ import { parseArgs } from 'node:util'; import { execute } from '@oclif/core'; async function main(isProduction = false) { - const { positionals } = parseArgs({ + const { positionals, values } = parseArgs({ allowPositionals: true, strict: false, // Don't validate flags + options: { + version: { type: 'boolean', short: 'v' }, + }, }); - // If no arguments at all, default to help - if (positionals.length === 0) { + // If no arguments at all, default to help (but not if --version/-v was passed) + if (positionals.length === 0 && !values.version) { process.argv.splice(2, 0, 'help'); } From fb96d70cd69d6597f027680631e97c411789ca1e Mon Sep 17 00:00:00 2001 From: Kevin Longmuir Date: Thu, 5 Mar 2026 17:07:37 -0500 Subject: [PATCH 2/2] feat: add support for version v alias --- README.md | 3 +-- package.json | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f39baff8..574c7efc 100644 --- a/README.md +++ b/README.md @@ -197,7 +197,7 @@ Scan a given SBOM for EOL data ``` USAGE $ hd scan eol [--json] [-f | -d ] [-s] [-o ] [--saveSbom] [--sbomOutput ] - [--saveTrimmedSbom] [--hideReportUrl] [--automated] [--version] + [--saveTrimmedSbom] [--hideReportUrl] [--automated] FLAGS -d, --dir= [default: ] The directory to scan in order to create a cyclonedx SBOM @@ -210,7 +210,6 @@ FLAGS --saveSbom Save the generated SBOM as herodevs.sbom.json in the scanned directory --saveTrimmedSbom Save the trimmed SBOM as herodevs.sbom-trimmed.json in the scanned directory --sbomOutput= Save the generated SBOM to a custom path (defaults to herodevs.sbom.json when not provided) - --version Show CLI version. GLOBAL FLAGS --json Format output as json. diff --git a/package.json b/package.json index 50e2a57b..854d0f9b 100644 --- a/package.json +++ b/package.json @@ -97,6 +97,7 @@ "license": "MIT", "main": "dist/index.js", "oclif": { + "additionalVersionFlags": ["-v"], "bin": "hd", "dirname": "hd", "commands": "./dist/commands",