Is there an equivalent in irb to command: history in bash?

Discussion in 'Ruby' started by Stephen Bannasch, Nov 19, 2007.

  1. Is there an equivalent in irb to the command history in bash?

    After I've been doing a bunch of work in the shell I often use the
    history command in bash to get a list of all the commands I've
    executed which I copy and past into an editor to document the work I
    did.

    Is there an equivalent command for irb which would list by lines each
    command I have entered? Rightnow I use readline to scan backwards
    and copy and paste individually.

    Thanks for any suggestions.
     
    Stephen Bannasch, Nov 19, 2007
    #1
    1. Advertising

  2. Stephen Bannasch

    Chris Shea Guest

    On Nov 18, 10:44 pm, Stephen Bannasch <>
    wrote:
    > Is there an equivalent in irb to the command history in bash?
    >
    > After I've been doing a bunch of work in the shell I often use the
    > history command in bash to get a list of all the commands I've
    > executed which I copy and past into an editor to document the work I
    > did.
    >
    > Is there an equivalent command for irb which would list by lines each
    > command I have entered? Rightnow I use readline to scan backwards
    > and copy and paste individually.
    >
    > Thanks for any suggestions.


    I think this irb_history business from Ben Bleything is what you want:
    http://blog.bleything.net/pages/irb_history

    HTH,
    Chris
     
    Chris Shea, Nov 19, 2007
    #2
    1. Advertising

  3. Ben Bleything, Nov 19, 2007
    #3
  4. Stephen Bannasch, Nov 19, 2007
    #4
  5. Stephen Bannasch

    sishen Guest

    Note: parts of this message were removed by the gateway to make it a legal Usenet post.

    Hi, Ben. really great work, :)

    One more feature request: Why not auto save the history in .irb_history,
    just like what the history of bash does?

    sishen

    On Nov 19, 2007 3:27 PM, Ben Bleything <> wrote:

    > On Mon, Nov 19, 2007, Chris Shea wrote:
    > > I think this irb_history business from Ben Bleything is what you want:
    > > http://blog.bleything.net/pages/irb_history

    >
    > I think so too ;)
    >
    > Ben
    >
    >
     
    sishen, Nov 19, 2007
    #5
  6. On Tue, Nov 20, 2007, sishen wrote:
    > Hi, Ben. really great work, :)


    Thanks!

    > One more feature request: Why not auto save the history in .irb_history,
    > just like what the history of bash does?


    So that's something that should probably be documented better. The code
    that I wrote relies on pre-existing history enabler code. It is meant
    as a supplement to something like Michael Granger's persistent IRB
    history:

    http://www.rubygarden.org/Ruby/page/show/Irb/TipsAndTricks

    or Wirble (gem install wirble), which just packages the above with some
    other IRB hacks. If you set up Michael's code or install wirble and
    enable history, it'll save your history between sessions.

    My code does not replace that stuff; it serves a different purpose.
    Mine is about accessing the history you already have. I've been meaning
    to re-open a conversation I was having with wirble's author over a year
    ago, to get my code included there. Once that happens (if Paul is still
    interested), you'll be able to just install/enable wirble and have all
    your history goodies for free.

    Hope that answers your question :)

    Ben
     
    Ben Bleything, Nov 19, 2007
    #6
  7. On Mon, 19 Nov 2007, Ben Bleything wrote:

    > On Mon, Nov 19, 2007, Chris Shea wrote:
    >> I think this irb_history business from Ben Bleything is what you want:
    >> http://blog.bleything.net/pages/irb_history

    >
    > I think so too ;)
    >
    > Ben


    Ben, don't you want to add a link from the blog entry to where people can
    get the chunk of code that will perform the magic?
    *t

    --
    -----------------------------------------------------------
    Tomas Pospisek
    http://sourcepole.com - Linux & Open Source Solutions
    -----------------------------------------------------------
     
    Tomas Pospisek's Mailing Lists, Nov 19, 2007
    #7
  8. On Tue, Nov 20, 2007, Tomas Pospisek's Mailing Lists wrote:
    > >On Mon, Nov 19, 2007, Chris Shea wrote:
    > >>I think this irb_history business from Ben Bleything is what you want:
    > >>http://blog.bleything.net/pages/irb_history

    >
    > Ben, don't you want to add a link from the blog entry to where people can
    > get the chunk of code that will perform the magic?


    The link from the thread takes you to the actual code, and both blog
    posts (linked below) link to it as well. Maybe it's not obvious enough?
    Or are you talking about a different page?

    http://blog.bleything.net/2006/10/21/shell-style-history-for-irb
    http://blog.bleything.net/2007/7/30/announcing-shell-style-history-for-irb-the-fixed-edition

    Ben
     
    Ben Bleything, Nov 19, 2007
    #8
  9. Stephen Bannasch

    sishen Guest

    Note: parts of this message were removed by the gateway to make it a legal Usenet post.

    Cool~, :)

    On Nov 20, 2007 5:07 AM, Ben Bleything <> wrote:

    > On Tue, Nov 20, 2007, sishen wrote:
    > > Hi, Ben. really great work, :)

    >
    > Thanks!
    >
    > > One more feature request: Why not auto save the history in .irb_history,
    > > just like what the history of bash does?

    >
    > So that's something that should probably be documented better. The code
    > that I wrote relies on pre-existing history enabler code. It is meant
    > as a supplement to something like Michael Granger's persistent IRB
    > history:
    >
    > http://www.rubygarden.org/Ruby/page/show/Irb/TipsAndTricks
    >
    > or Wirble (gem install wirble), which just packages the above with some
    > other IRB hacks. If you set up Michael's code or install wirble and
    > enable history, it'll save your history between sessions.
    >
    > My code does not replace that stuff; it serves a different purpose.
    > Mine is about accessing the history you already have. I've been meaning
    > to re-open a conversation I was having with wirble's author over a year
    > ago, to get my code included there. Once that happens (if Paul is still
    > interested), you'll be able to just install/enable wirble and have all
    > your history goodies for free.
    >
    > Hope that answers your question :)
    >
    > Ben
    >
    >
     
    sishen, Nov 20, 2007
    #9
  10. On Tue, 20 Nov 2007, Ben Bleything wrote:

    > On Tue, Nov 20, 2007, Tomas Pospisek's Mailing Lists wrote:
    >>> On Mon, Nov 19, 2007, Chris Shea wrote:
    >>>> I think this irb_history business from Ben Bleything is what you want:
    >>>> http://blog.bleything.net/pages/irb_history

    >>
    >> Ben, don't you want to add a link from the blog entry to where people can
    >> get the chunk of code that will perform the magic?

    >
    > The link from the thread takes you to the actual code, and both blog
    > posts (linked below) link to it as well. Maybe it's not obvious enough?
    > Or are you talking about a different page?
    >
    > http://blog.bleything.net/2006/10/21/shell-style-history-for-irb
    > http://blog.bleything.net/2007/7/30/announcing-shell-style-history-for-irb-the-fixed-edition


    Oh, I was coming from the "RubyConf stuff" blog entry which AFAICS doesn't
    have a pointer to the code. I didn't verify the other blog entries links
    :-o
    *t

    --
    -----------------------------------------------------------
    Tomas Pospisek
    http://sourcepole.com - Linux & Open Source Solutions
    -----------------------------------------------------------
     
    Tomas Pospisek's Mailing Lists, Nov 20, 2007
    #10
  11. On Tue, Nov 20, 2007, Tomas Pospisek's Mailing Lists wrote:
    > Oh, I was coming from the "RubyConf stuff" blog entry which AFAICS doesn't
    > have a pointer to the code. I didn't verify the other blog entries links
    > :-o


    Woops! You're right, and I should fix that. And now I have. Thanks :)

    Ben
     
    Ben Bleything, Nov 21, 2007
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. William Park

    (patch for Bash) GTK+2 + Bash

    William Park, Jul 11, 2005, in forum: XML
    Replies:
    3
    Views:
    2,331
    William Park
    Jul 14, 2005
  2. Sam Stephenson
    Replies:
    1
    Views:
    261
    Andrew Walrond
    Jun 18, 2005
  3. Replies:
    8
    Views:
    498
  4. richard apodaca
    Replies:
    1
    Views:
    96
    Mat Schaffer
    Jul 13, 2006
  5. sa 125
    Replies:
    3
    Views:
    142
    Markus Fischer
    Jun 2, 2009
Loading...

Share This Page