Skip to content

Commit

Permalink
Add -v alias for --version.
Browse files Browse the repository at this point in the history
  • Loading branch information
raineorshine committed Apr 2, 2023
1 parent 40ac4a1 commit b9fb103
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ groupFunction* Customize how packages are divided into groups
[])
-ws, --workspaces Run on all workspaces. Add --root to also upgrade
the root project.
-V, --version Output the version number.
-v, -V, --version Output the version number.
-h, --help You're lookin' at it.
```

Expand Down
5 changes: 4 additions & 1 deletion src/bin/cli.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env node
import { Help, program } from 'commander'
import Commander, { Help, program } from 'commander'
import cloneDeep from 'lodash/cloneDeep'
import pickBy from 'lodash/pickBy'
import semver from 'semver'
Expand Down Expand Up @@ -91,11 +91,14 @@ ${chalk.dim.underline(
program
.description('[filter] is a list or regex of package names to check (all others will be ignored).')
.usage('[options] [filter]')
.addOption(new Commander.Option('-v, --version', 'Version!').hideHelp())
// See: boolean optional arg below
.configureHelp({
optionTerm: option =>
option.long && noCli.has(option.long)
? option.long.replace('--', '') + '*'
: option.long === '--version'
? '-v, -V, --version'
: option.flags.replace('[bool]', ''),
optionDescription: option =>
option.long === '--version'
Expand Down

0 comments on commit b9fb103

Please sign in to comment.