Skip to content

Instantly share code, notes, and snippets.

@petervandenabeele
Created December 19, 2010 15:35
Show Gist options
  • Save petervandenabeele/747418 to your computer and use it in GitHub Desktop.
Save petervandenabeele/747418 to your computer and use it in GitHub Desktop.
running irb from rvm does not use the prompt-mode option
UPDATE by peter_v 2010-12-19 15:53:00
* the issue also occurs with rvm use system
* so not related to rvm, but to irb
* discussed on irc with telemachus
peterv@ASUS:~$ rvm --version
rvm 1.1.6 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]
peterv@ASUS:~$ rvm use
Now using system ruby.
peterv@ASUS:~$ ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]
peterv@ASUS:~$ irb # with system ruby
irb(main):001:0> IRB.conf[:PROMPT_MODE]
=> :DEFAULT
irb(main):002:0> quit
peterv@ASUS:~$ irb --prompt-mode xmp
# this works as expected, PROMPT_I == nil
IRB.conf[:PROMPT_MODE]
==>:XMP
IRB.conf[:PROMPT][:XMP][:PROMPT_I]
==>nil
quit
peterv@ASUS:~$ rvm use 1.9.2 # now switching to one of the rvm supplied Ruby's
Using /home/peterv/.rvm/gems/ruby-1.9.2-p0
peterv@ASUS:~$ irb
ruby-1.9.2-p0 :001 > IRB.conf[:PROMPT_MODE]
=> :RVM
ruby-1.9.2-p0 :002 > IRB.conf[:PROMPT][:RVM][:PROMPT_I]
=> "ruby-1.9.2-p0 :%03n > "
ruby-1.9.2-p0 :003 > # this works as expected, RVM supplies its own prompt mode
ruby-1.9.2-p0 :004 > quit
peterv@ASUS:~$ irb --prompt-mode xmp
ruby-1.9.2-p0 :001 > IRB.conf[:PROMPT_MODE]
=> :RVM
ruby-1.9.2-p0 :002 > # this is not expected, irb under rvm, seems not
ruby-1.9.2-p0 :003 > # to use the --prompt-mode option from the command line
ruby-1.9.2-p0 :004 > quit
peterv@ASUS:~$ rvm use 1.8.7
Using /home/peterv/.rvm/gems/ruby-1.8.7-p302
peterv@ASUS:~$ irb --prompt-mode xmp
ruby-1.8.7-p302 :001 > IRB.conf[:PROMPT_MODE]
=> :RVM # same behavior on ruby 1.8.7
ruby-1.8.7-p302 :002 > quit
UPDATE by peter_v : the issue also occurs with rvm use system
I now installed a ~/.irbrc file
peterv@ASUS:~$ rvm use system
Now using system ruby.
peterv@ASUS:~$ irb --prompt-mode xmp
quit
peterv@ASUS:~$ irb --prompt-mode xmp
001:0> IRB.conf[:PROMPT_MODE]
=> :CUSTOM ### this was expected to be :XMP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment