Skip to content
  • Jonathan Hefner's avatar
    25301604
    Add "Did you mean?" for unrecognized CLI commands · 25301604
    Jonathan Hefner authored
    This commit improves the error message that is displayed when a user
    specifies an unrecognized `bin/rails` command by offering "Did you
    mean?" suggestions.  The suggestions cover all visible commands, and
    supersede any incomplete (Rake-task-only) suggestions that Rake might
    display.
    
    __Before (example)__
    
      ```console
      $ bin/rails credentails:edit
      rails aborted!
      Don't know how to build task 'credentails:edit' (See the list of available tasks with `rails --tasks`)
    
      (See full trace by running task with --trace)
    
      $ bin/rails --tasks
      ...
      rails cache_digests:dependencies         # Lookup first-level dependencies for TEMPLATE (like messages/show or comments/_comment.html)
      rails cache_digests:nested_dependencies  # Lookup nested dependencies for TEMPLATE (like messages/show or comments/_comment.html)
      rails db:create                          # Creates the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use ...
      rails db:drop                            # Drops the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db...
      ...
    
      $ bin/rails credentails -h
      # no output
    
      $ bin/rails credentials -h
      # no output
    
      $ bin/rails versoin
      rails aborted!
      Don't know how to build task 'versoin' (See the list of available tasks with `rails --tasks`)
      Did you mean?  db:version
    
      (See full trace by running task with --trace)
      ```
    
    __After (example)__
    
      ```console
      $ bin/rails credentails:edit
      Unrecognized command "credentails:edit" (Rails::Command::UnrecognizedCommandError)
      Did you mean?  credentials:edit
    
      $ bin/rails credentails -h
      Unrecognized command "credentails" (Rails::Command::UnrecognizedCommandError)
      Did you mean?  credentials:diff
    
      $ bin/rails credentials -h
      Unrecognized command "credentials" (Rails::Command::UnrecognizedCommandError)
      Did you mean?  credentials:diff
    
      $ bin/rails versoin
      Unrecognized command "versoin" (Rails::Command::UnrecognizedCommandError)
      Did you mean?  version
      ```
    25301604
    Add "Did you mean?" for unrecognized CLI commands
    Jonathan Hefner authored
    This commit improves the error message that is displayed when a user
    specifies an unrecognized `bin/rails` command by offering "Did you
    mean?" suggestions.  The suggestions cover all visible commands, and
    supersede any incomplete (Rake-task-only) suggestions that Rake might
    display.
    
    __Before (example)__
    
      ```console
      $ bin/rails credentails:edit
      rails aborted!
      Don't know how to build task 'credentails:edit' (See the list of available tasks with `rails --tasks`)
    
      (See full trace by running task with --trace)
    
      $ bin/rails --tasks
      ...
      rails cache_digests:dependencies         # Lookup first-level dependencies for TEMPLATE (like messages/show or comments/_comment.html)
      rails cache_digests:nested_dependencies  # Lookup nested dependencies for TEMPLATE (like messages/show or comments/_comment.html)
      rails db:create                          # Creates the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use ...
      rails db:drop                            # Drops the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db...
      ...
    
      $ bin/rails credentails -h
      # no output
    
      $ bin/rails credentials -h
      # no output
    
      $ bin/rails versoin
      rails aborted!
      Don't know how to build task 'versoin' (See the list of available tasks with `rails --tasks`)
      Did you mean?  db:version
    
      (See full trace by running task with --trace)
      ```
    
    __After (example)__
    
      ```console
      $ bin/rails credentails:edit
      Unrecognized command "credentails:edit" (Rails::Command::UnrecognizedCommandError)
      Did you mean?  credentials:edit
    
      $ bin/rails credentails -h
      Unrecognized command "credentails" (Rails::Command::UnrecognizedCommandError)
      Did you mean?  credentials:diff
    
      $ bin/rails credentials -h
      Unrecognized command "credentials" (Rails::Command::UnrecognizedCommandError)
      Did you mean?  credentials:diff
    
      $ bin/rails versoin
      Unrecognized command "versoin" (Rails::Command::UnrecognizedCommandError)
      Did you mean?  version
      ```
Loading