Skip to content

Commit

Permalink
Fix cacjs#151
Browse files Browse the repository at this point in the history
  • Loading branch information
domdomegg committed Feb 17, 2023
1 parent af9d179 commit 442f469
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/CAC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class CAC extends EventEmitter {
if (shouldParse) {
// Search the default command
for (const command of this.commands) {
if (command.name === '') {
if (command.isDefaultCommand) {
shouldParse = false
const parsed = this.mri(argv.slice(2), command)
this.setParsedInfo(parsed, command)
Expand All @@ -220,7 +220,11 @@ class CAC extends EventEmitter {
this.unsetMatchedCommand()
}

if (this.options.version && this.showVersionOnExit && this.matchedCommandName == null) {
if (
this.options.version &&
this.showVersionOnExit &&
this.matchedCommandName == null
) {
this.outputVersion()
run = false
this.unsetMatchedCommand()
Expand Down

0 comments on commit 442f469

Please sign in to comment.