editing on the command line

Discussion in 'Ruby' started by greg, Apr 15, 2007.

  1. greg

    greg Guest

    I want to output some text to the the terminal and allow the user to
    edit it. Like the ability you get when using irb and go back in the
    history. Basically a readline but the outputted text would be
    editable instead of a prompt. I cannot find any way to do this using
    standard tools or with any libraries. Any help is greatly appreciated.
    greg, Apr 15, 2007
    #1
    1. Advertising

  2. On 15.04.2007 17:20, greg wrote:
    > I want to output some text to the the terminal and allow the user to
    > edit it. Like the ability you get when using irb and go back in the
    > history. Basically a readline but the outputted text would be
    > editable instead of a prompt. I cannot find any way to do this using
    > standard tools or with any libraries. Any help is greatly appreciated.


    If you are on some kind of Unix your favorite shell usually offers this
    service. IIRC Ruby comes with readline built in, so you might be able
    to use it from a Ruby program. Does that help?

    Kind regards

    robert
    Robert Klemme, Apr 15, 2007
    #2
    1. Advertising

  3. greg

    greg Guest

    I am looking for cross-shell/platform compatibility, but if there is a
    way to delegate this task to the shell I would be interested in
    knowing anyways.
    It seems there are over ten IRC libraries, which one are you referring
    too? I doubt those libraries would be doing anything other than the
    standard Readline.readline though.

    On Apr 15, 11:15 am, Robert Klemme <> wrote:
    > On 15.04.2007 17:20, greg wrote:
    >
    > > I want to output some text to the the terminal and allow the user to
    > > edit it. Like the ability you get when using irb and go back in the
    > > history. Basically a readline but the outputted text would be
    > > editable instead of a prompt. I cannot find any way to do this using
    > > standard tools or with any libraries. Any help is greatly appreciated.

    >
    > If you are on some kind of Unix your favorite shell usually offers this
    > service. IIRC Ruby comes with readline built in, so you might be able
    > to use it from a Ruby program. Does that help?
    >
    > Kind regards
    >
    > robert
    greg, Apr 15, 2007
    #3
  4. greg wrote:
    > On Apr 15, 11:15 am, Robert Klemme <> wrote:
    >> On 15.04.2007 17:20, greg wrote:
    >>
    >>> I want to output some text to the the terminal and allow the user to
    >>> edit it. Like the ability you get when using irb and go back in the
    >>> history. Basically a readline but the outputted text would be
    >>> editable instead of a prompt. I cannot find any way to do this
    >>> using standard tools or with any libraries. Any help is greatly
    >>> appreciated.

    >> If you are on some kind of Unix your favorite shell usually offers
    >> this service. IIRC Ruby comes with readline built in, so you might
    >> be able to use it from a Ruby program. Does that help?


    > I am looking for cross-shell/platform compatibility, but if there is a
    > way to delegate this task to the shell I would be interested in
    > knowing anyways.
    > It seems there are over ten IRC libraries, which one are you referring
    > too? I doubt those libraries would be doing anything other than the
    > standard Readline.readline though.


    Firstly:
    A: It messes with the readability of responses.
    Q: Why is top-quoting bad?

    Secondly:
    IIRC == "If I Remember Correctly" != Internet Relay Chat.

    Thirdly:
    Readline.readline is what Robert Klemme meant, if I parse the thread
    correctly.


    --
    Phillip "CynicalRyan" Gawlowski
    http://cynicalryan.110mb.com/
    http://clothred.rubyforge.org

    Eek! That was supposed to be My Special Law, _MY_ special law, I tell
    you!

    T/
    Phillip Gawlowski, Apr 15, 2007
    #4
  5. greg

    greg Guest

    Phillip Gawlowski wrote:
    > greg wrote:
    > > On Apr 15, 11:15 am, Robert Klemme <> wrote:
    > >> On 15.04.2007 17:20, greg wrote:
    > >>
    > >>> I want to output some text to the the terminal and allow the user to
    > >>> edit it. Like the ability you get when using irb and go back in the
    > >>> history. Basically a readline but the outputted text would be
    > >>> editable instead of a prompt. I cannot find any way to do this
    > >>> using standard tools or with any libraries. Any help is greatly
    > >>> appreciated.
    > >> If you are on some kind of Unix your favorite shell usually offers
    > >> this service. IIRC Ruby comes with readline built in, so you might
    > >> be able to use it from a Ruby program. Does that help?

    >
    > > I am looking for cross-shell/platform compatibility, but if there is a
    > > way to delegate this task to the shell I would be interested in
    > > knowing anyways.
    > > It seems there are over ten IRC libraries, which one are you referring
    > > too? I doubt those libraries would be doing anything other than the
    > > standard Readline.readline though.

    >
    > Firstly:
    > A: It messes with the readability of responses.
    > Q: Why is top-quoting bad?
    >
    > Secondly:
    > IIRC == "If I Remember Correctly" != Internet Relay Chat.
    >
    > Thirdly:
    > Readline.readline is what Robert Klemme meant, if I parse the thread
    > correctly.
    >
    >
    > --
    > Phillip "CynicalRyan" Gawlowski
    > http://cynicalryan.110mb.com/
    > http://clothred.rubyforge.org
    >
    > Eek! That was supposed to be My Special Law, _MY_ special law, I tell
    > you!
    >
    > T/


    Readline.readline does not have this capability.
    greg, Apr 15, 2007
    #5
    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. John

    vi-style command-line editing in gdb

    John, Nov 14, 2003, in forum: C Programming
    Replies:
    2
    Views:
    327
    Tristan Miller
    Nov 14, 2003
  2. enjoylife_95135
    Replies:
    2
    Views:
    330
    enjoylife_95135
    Aug 15, 2004
  3. Replies:
    0
    Views:
    576
  4. Joel VanderWerf

    command line editing in irb under MSYS

    Joel VanderWerf, Nov 25, 2003, in forum: Ruby
    Replies:
    1
    Views:
    127
    Joel VanderWerf
    Nov 25, 2003
  5. haomiao
    Replies:
    2
    Views:
    102
    haomiao
    Jul 25, 2007
Loading...

Share This Page