Skip to content

Commit

Permalink
Upgrade commander.
Browse files Browse the repository at this point in the history
  • Loading branch information
raineorshine committed Mar 14, 2024
1 parent c858951 commit 8ed0580
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
19 changes: 14 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"@typescript-eslint/parser": "^7.2.0",
"chalk": "^5.3.0",
"cli-table3": "^0.6.3",
"commander": "^11.1.0",
"commander": "^12.0.0",
"fast-glob": "^3.3.2",
"fast-memoize": "^2.5.2",
"find-up": "5.0.0",
Expand Down
8 changes: 6 additions & 2 deletions src/bin/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ ${chalk.dim.underline(
program
.description('[filter] is a list or regex of package names to check (all others will be ignored).')
.usage('[options] [filter]')
// add hidden -v alias for --V/--version
.addOption(new Commander.Option('-v, --version').hideHelp())
// See: boolean optional arg below
.configureHelp({
optionTerm: option =>
Expand All @@ -117,6 +115,12 @@ ${chalk.dim.underline(
? `You're lookin' at it.`
: Help.prototype.optionDescription(option),
})
// add hidden -v alias for --V/--version
.addOption(new Commander.Option('-v, --versionAlias').hideHelp())
.on('option:versionAlias', () => {
console.info(pkg.version)
process.exit(0)
})

// add cli options
cliOptions.forEach(({ long, short, arg, description, default: defaultValue, help, parse, type }) => {
Expand Down

0 comments on commit 8ed0580

Please sign in to comment.