File tree 1 file changed +4
-3
lines changed 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,9 @@ const semver = require('semver')
8
8
const requiredVersion = require ( '../package.json' ) . engines . node
9
9
const didYouMean = require ( 'didyoumean' )
10
10
11
+ // Setting edit distance to 60% of the input string's length
12
+ didYouMean . threshold = 0.6
13
+
11
14
function checkNodeVersion ( wanted , id ) {
12
15
if ( ! semver . satisfies ( process . version , wanted ) ) {
13
16
console . log ( chalk . red (
@@ -190,12 +193,11 @@ program
190
193
) . then ( console . log )
191
194
} )
192
195
193
- suggestCommands ( process . argv . slice ( 2 ) [ 0 ] )
194
-
195
196
// output help information on unknown commands
196
197
program
197
198
. arguments ( '<command>' )
198
199
. action ( ( cmd ) => {
200
+ suggestCommands ( cmd )
199
201
program . outputHelp ( )
200
202
console . log ( ` ` + chalk . red ( `Unknown command ${ chalk . yellow ( cmd ) } .` ) )
201
203
console . log ( )
@@ -241,7 +243,6 @@ function suggestCommands (cmd) {
241
243
const suggestion = didYouMean ( cmd , availableCommands )
242
244
if ( suggestion ) {
243
245
console . log ( chalk . cyan ( `Warning: ${ chalk . yellow ( `Did you mean ${ suggestion } ?` ) } ` ) )
244
- process . exit ( 1 )
245
246
}
246
247
}
247
248
You can’t perform that action at this time.
0 commit comments