irb icon indicating copy to clipboard operation
irb copied to clipboard

Add start up message

Open st0012 opened this issue 2 years ago • 5 comments

When starting IRB directly, it could be helpful to users to have a few information printed, like:

  • Ruby version
  • Reline version?
  • Minimum instructions, like how to get help or exit the session

Requirements

  • It should be printed when IRB is started with the irb command
  • It should NOT be printed when binding.irb is called
  • It should NOT be printed when Rails console is invoked
  • There should be a way to disable it
    • I prefer env var over IRB.conf on this

Examples

$ be irb
IRB 1.7.4 (Ruby 3.2.2, Reline 0.3.8)
  Help: show_cmds
  Exit: exit or Ctrl-D
irb(main):001> 

st0012 avatar Aug 20 '23 18:08 st0012

I would add a newline gap between the startup and the prompt, otherwise yes!

zzak avatar Aug 21 '23 10:08 zzak

I think it is good! I will share my concerns.

I think the importance for users is Ruby version > IRB version > Reline version. irb_info may be sufficient since IRB and Reline versions are important mainly for issue reporting.

I think it is better to reduce the number of lines as much as possible since it is displayed at every startup. 2 lines seemed to be enough for Python and Node.js. Personally, I thought that exit might be unnecessary.

$ node
Welcome to Node.js v20.5.1.
Type ".help" for more information.
>

$ python
Python 3.11.4 (main, Jun 20 2023, 16:59:59) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

ima1zumi avatar Aug 22 '23 11:08 ima1zumi

Do we need to discuss this at https://bugs.ruby-lang.org/ ?

By the way,

  • There should be a way to disable it
    • I prefer env var over IRB.conf on this

I prefer IRB.conf. And, command line option like Python.

% python3 -q
>>>

elfham avatar Aug 22 '23 17:08 elfham

@ima1zumi

I think the importance for users is Ruby version > IRB version > Reline version.

Yeah I agree. We can start with just the Ruby version.

Personally, I thought that exit might be unnecessary.

Ok let's just display show_cmds first 👍

@elfham

Do we need to discuss this at https://bugs.ruby-lang.org/ ?

I prefer IRB.conf.

Do you mind explaining the reason?

And, command line option like Python.

Yeah I can see some users requesting it.

st0012 avatar Aug 24 '23 11:08 st0012

Do we need to discuss this at https://bugs.ruby-lang.org/ ?

Since many Ruby users run irb many times a day, this change does not seem so small, so I thought more people (e.g. ruby-core) should be aware of this change.

I prefer IRB.conf.

Environment variables need to be set in several files, such as bashrc, zshrc, profile, and so on. Therefore, it would be good if they could be consolidated in irbrc.

The best thing is that env, irbrc, and option can all be set.

elfham avatar Aug 24 '23 12:08 elfham