diff options
author | Genadi Samokovarov <gsamokovarov@gmail.com> | 2018-03-17 15:55:44 +0200 |
---|---|---|
committer | Genadi Samokovarov <gsamokovarov@gmail.com> | 2018-03-23 11:36:03 +0200 |
commit | cb25f2c989588edf77f978820196b4446e01ffe8 (patch) | |
tree | 0dd189e6496b065194ec99a04b5c3e3651449031 /railties/lib/rails/commands | |
parent | ef73318e29666786feb00e9e9b3b49a771bb0b73 (diff) | |
download | rails-cb25f2c989588edf77f978820196b4446e01ffe8.tar.gz rails-cb25f2c989588edf77f978820196b4446e01ffe8.tar.bz2 rails-cb25f2c989588edf77f978820196b4446e01ffe8.zip |
Use `did_you_mean` spell checker for option suggestions
Now that we require Ruby over `2.3`, we can replace the current
suggestion methods we have with tooling from the `did_you_mean` gem.
There is a small user visible change and this is that we now offer a
single suggestion for misspelled options. We are suggesting fixes during
generator invocation and during a mistyped rails server rack handler. In
both cases, if we don't make a proper prediction on the first match, we
won't do so in the second or third one, so in my mind, this is okay.
Diffstat (limited to 'railties/lib/rails/commands')
-rw-r--r-- | railties/lib/rails/commands/server/server_command.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/railties/lib/rails/commands/server/server_command.rb b/railties/lib/rails/commands/server/server_command.rb index 8588e2fd64..6da300e356 100644 --- a/railties/lib/rails/commands/server/server_command.rb +++ b/railties/lib/rails/commands/server/server_command.rb @@ -283,10 +283,10 @@ module Rails Run `rails server --help` for more options. MSG else - suggestions = Rails::Command::Spellchecker.suggest(server, from: RACK_SERVERS).map(&:inspect) + suggestions = Rails::Command::Spellchecker.suggest(server, from: RACK_SERVERS) <<~MSG - Could not find server "#{server}". Maybe you meant #{suggestions.first} or #{suggestions.second}? + Could not find server "#{server}". Maybe you meant #{suggestions.inspect}? Run `rails server --help` for more options. MSG end |