Third Replicator,

If you are using some Linux system then you are safe. I use Ubuntu myself. I
was tied of rewriting everything I put on the console too. So I with some
little effort and help from friends, I made a small hack. Now, I have a
simple script that helps me keep track of command-line history for both *irb
* and *script/console*.

Follow the steps below:

   - *create* *.irbrc* file in your home directory :

ceek...@kanjedza:~$ touch .irbrc

   - *open* *.irbrc* using your preferred text editor (I prefer command-line
   based ones: *vi, vim, gvim*), *add* the following lines and* save*:

*# This script saves and retrieves up to 600 lines of
# command-line history in both irb and script/console
# of a **Rails's project. (UP and DOWN ARROW keys to navigate)
# In addition, it supports auto-completion.(Use the
# TAB key to get auto-complete suggestions).*
*# *
*# :SAVE_HISTORY keeps the maximum number of lines to be saved
# customize this to suite the amount of history would
# like to retrieve
#
# :HISTORY_FILE keeps the file name where the
# history is kept. In this case it is saved in the
# home directory of the current user
# i.e in the same directory where as this .irbrc file
*
ARGV.concat [ "--readline", "--prompt-mode", "simple" ]
require 'irb/completion'
require 'irb/ext/save-history'
require 'rubygems'
require 'map_by_method'
require 'wirble'
require 'pp'

IRB.conf[:AUTO_INDENT]= true
IRB.conf[:SAVE_HISTORY] = 600
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"

Wirble.init
Wirble.colorize

Once you have this, you will be able to retrieve script/console's
command-line history up to 600 lines. Please inform me if doesn't work. I
would be very happy to get as much input as possible.

I think *Sprite* will also find this useful.
*
P/S: I am not sure if I have violated the forum rules by adding an
attachment. If so, forgive me and inform me how best I can send files
through.*

Regards,

---
Edmond
Software Developer | Baobab Health Trust (http://www.baobabhealth.org/) |
Malawi

Cell:  +265 999 465 137 | +265 881 234 717

*"Many people doubt open source software and probably don’t realize that
there is an alternative… which is just as good.." -- Kevin Scannell*



On 11 August 2010 11:49, Third Replicator <[email protected]> wrote:

> When you quit script/console you lose your command history.  What
> would it take to get get that command history to persist?  I wouldn't
> mind working on it if somebody had a good suggestion as to how to
> achieve that and if it was an acceptable solution to the core team.
>
> Cheers,
> D :)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Attachment: .irbrc
Description: Binary data

Reply via email to