-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request: rename Rails console as irr or something other than irb #50770
Comments
You can create a if ENV["RAILS_ENV"]
IRB.conf[:PROMPT][:RAILS] = IRB.conf[:PROMPT][:DEFAULT].clone
IRB.conf[:PROMPT][:RAILS][:PROMPT_I] = "%N(rails):%03n> "
IRB.conf[:PROMPT_MODE] = :RAILS
end |
Thanks. Works like a charm. |
Maybe we should do that automatically. @dhh what do you think? |
What's the problem we're trying to solve? |
Why is it an issue that the prompt is the same between vanilla irb and irb loaded with the Rails app? That's the first time I've heard of that causing someone problems. |
I believe because of the methods available in Rails console are drastically different from just calling In general, I think it would be good developer experience to Rails to show a more informative prompt. |
Yeah, I could be on for making it more informative. Like including the env. But also don't want to make the line too long. Don't think adding (rails) to it is meaningful. |
Length: Maybe They are different environments and shouldn't look the same. |
Actually, if anything, we should shave off the needless prefixing. "irb(main):001>" is just noise for us. But I'd take "dev:001>" and "prod:001>". Problem is we don't have any structured abbreviated names for envs. You don't want "development:001>" and "production:001>". Too long. |
An example of where confusion can arise. In Active Record Query Interface, Section 2.1.1, the following example |
Oops, looks like I closed this too early and there is more to it, sorry!
For reference, the prompt name on a postgres repl is the name of the database, which never bothered me and felt it was too long. 🤷
|
Just to add some ideas and notes:
|
@st0012 can we move forward with |
@rafaelfranca sure no problem. I'll prepare a PR for it. |
Is the |
Agree, I'd rather do without. |
Maybe the saved space could display the app/folder name, like |
I think the application name would be valuable yes, especially for people who often juggle between multiple applications. My preference goes to |
Dig that a lot 👌 |
Following the discussion in rails#50770, the new format will be: `[dasherized-app-name]([colorized-env])>` For example, if the app's module name is `MyApp`, the prompt will be: `my-app(dev)>`, where the `dev` part will be colored with green.
Following the discussion in rails#50770, the new format will be: `[dasherized-app-name]([colorized-env])>` For example, if the app's module name is `MyApp`, the prompt will be: `my-app(dev)>`, where the `dev` part will be colored.
PR for the prompt change: #50825 |
Following the discussion in rails#50770, the new format will be: `[dasherized-app-name]([colorized-env])>` For example, if the app's module name is `MyApp`, the prompt will be: `my-app(dev)>`, where the `dev` part will be colored. Update railties/lib/rails/commands/console/console_command.rb Co-authored-by: Jean Boussier <jean.boussier@gmail.com> Update changelog
Wouldn't development and production be more consistent with the rest of the usage in rails? |
Would you consider adding the Rails version to the prompt? Eg. We've found it handy when doing upgrades, or switching between apps on different versions. |
Too much for me. But great to point someone at how they can customize this further. Context > Consistency on prod/dev. I don't want a long prefacing line. It's just ugly. |
Following the discussion in rails#50770, the new format will be: `[dasherized-app-name]([colorized-env])>` For example, if the app's module name is `MyApp`, the prompt will be: `my-app(dev)>`, where the `dev` part will be colored. Update railties/lib/rails/commands/console/console_command.rb Co-authored-by: Jean Boussier <jean.boussier@gmail.com> Update changelog
Maybe not the right place to post this.
But it's confusing that the prompt for irb and rails console is the same.
The text was updated successfully, but these errors were encountered: