Skip to content

Commit 442f469

Browse files
committed
Fix cacjs#151
1 parent af9d179 commit 442f469

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/CAC.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ class CAC extends EventEmitter {
200200
if (shouldParse) {
201201
// Search the default command
202202
for (const command of this.commands) {
203-
if (command.name === '') {
203+
if (command.isDefaultCommand) {
204204
shouldParse = false
205205
const parsed = this.mri(argv.slice(2), command)
206206
this.setParsedInfo(parsed, command)
@@ -220,7 +220,11 @@ class CAC extends EventEmitter {
220220
this.unsetMatchedCommand()
221221
}
222222

223-
if (this.options.version && this.showVersionOnExit && this.matchedCommandName == null) {
223+
if (
224+
this.options.version &&
225+
this.showVersionOnExit &&
226+
this.matchedCommandName == null
227+
) {
224228
this.outputVersion()
225229
run = false
226230
this.unsetMatchedCommand()

0 commit comments

Comments
 (0)