Is there a way to make “rake routes” look better?

前端 未结 9 1308
谎友^
谎友^ 2021-02-04 04:38

I am always forced to make my terminal window two dual monitors wide just to see read them right. I\'m not a stickler for buttery GUI\'s, but this is ridiculous.

Is ther

9条回答
  •  太阳男子
    2021-02-04 05:32

    Rails 6+

    For those, who anyway want to use their terminal to view complicated rails routes.

    Rails 6 introduced --expanded option to print them in a more convenient way.

    Here is an example:

    $ rails routes --expanded
    --[ Route 1 ]------------------------------------------------------------
    Prefix            | high_scores
    Verb              | GET
    URI               | /high_scores(.:format)
    Controller#Action | high_scores#index
    --[ Route 2 ]------------------------------------------------------------
    Prefix            | new_high_score
    Verb              | GET
    URI               | /high_scores/new(.:format)
    Controller#Action | high_scores#new
    --[ Route 3 ]------------------------------------------------------------
    Prefix            | blog
    Verb              |
    URI               | /blog
    Controller#Action | Blog::Engine
    
    [ Routes for Blog::Engine ]
    --[ Route 1 ]------------------------------------------------------------
    Prefix            | cart
    Verb              | GET
    URI               | /cart(.:format)
    Controller#Action | cart#show
    

    And a link to PR.

提交回复
热议问题