1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

5 commits

Author SHA1 Message Date
Kasper Timm Hansen
6629d51a27
Rely on Rails::Command's help output.
We end up with:

```
Usage:
  bin/rails routes [options]

Options:
  -c, [--controller=CONTROLLER]      # Filter by a specific controller, e.g. PostsController or Admin::PostsController.
  -g, [--grep=GREP]                  # Grep routes by a specific pattern.
  -E, [--expanded], [--no-expanded]  # Print routes expanded vertically with parts explained.
```

which does miss the bit about routes being printed in order.

Also:

* Renames options to ease help output readability, then clarifies each option.
* Fixes a bunch of indentation.
2018-03-13 20:56:37 +01:00
Kasper Timm Hansen
f6310a3f16
Extract details to methods to clarify command. 2018-03-13 20:22:23 +01:00
bogdanvlviv
304906f1bd
Introduce ActionDispatch::Routing::ConsoleFormatter::Base
- Create `Base` and inherit `Sheet` and `Expanded` in order to
- prevent code duplication.
  - Remove trailing "\n" for components of `Expanded`.
  - There is no need for `Expanded#header` to return `@buffer` so return `nil` instead.

- Change `no_routes` message "No routes were found for this controller"
  since if use `-g`, it sounds incorrect.
  - Display `No routes were found for this controller.` if apply `-c`.
  - Display `No routes were found for this grep pattern.` if apply `-g`.

Related to #32130
2018-03-13 11:58:52 +02:00
Benoit Tigeot
c6d928f3ca Add --expanded option to "rails routes"
When using rails routes with small terminal or complicated routes it can be
very difficult to understand where is the element listed in header. psql
had the same issue, that's why they created "expanded mode" you can
switch using `\x` or by starting psql with
```
-x
--expanded

    Turn on the expanded table formatting mode. This is equivalent to the \x command.
```
The output is similar to one implemented here for rails routes:

db_user-# \du
List of roles
-[ RECORD 1 ]----------------------------------------------
Role name  | super
Attributes | Superuser, Create role, Create DB
Member of  | {}
-[ RECORD 2 ]----------------------------------------------
Role name  | role
Attributes | Superuser, Create role, Create DB, Replication
Member of  | {}
2018-02-28 22:32:34 +01:00
Benoit Tigeot
a2748eda58 Move rake routes task to rails command
After a discussion with matthewd. It was mentioned that rake tasks need
to be moved to rails command.
See: https://github.com/rails/rails/issues/32117
2018-02-27 15:22:38 +01:00