Skip to content

Commit

Permalink
Merge pull request #761 from deivid-rodriguez/support_latest_did_you_…
Browse files Browse the repository at this point in the history
…mean

Support latest did_you_mean
  • Loading branch information
rafaelfranca authored Jan 4, 2022
2 parents 5c666b4 + 98dbec7 commit 05a79fc
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/thor/error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,14 @@ class MalformattedArgumentError < InvocationError
end

if Correctable
DidYouMean::SPELL_CHECKERS.merge!(
'Thor::UndefinedCommandError' => UndefinedCommandError::SpellChecker,
'Thor::UnknownArgumentError' => UnknownArgumentError::SpellChecker
)
if DidYouMean.respond_to?(:correct_error)
DidYouMean.correct_error(Thor::UndefinedCommandError, UndefinedCommandError::SpellChecker)
DidYouMean.correct_error(Thor::UnknownArgumentError, UnknownArgumentError::SpellChecker)
else
DidYouMean::SPELL_CHECKERS.merge!(
'Thor::UndefinedCommandError' => UndefinedCommandError::SpellChecker,
'Thor::UnknownArgumentError' => UnknownArgumentError::SpellChecker
)
end
end
end

0 comments on commit 05a79fc

Please sign in to comment.