Highline and Termios issues

Discussion in 'Ruby' started by Ed Howland, Oct 10, 2010.

  1. Ed Howland

    Ed Howland Guest

    Hi,

    I have question re: Highline. In this code fragment, when running on MacOS/=
    X:

    agree("overwite #{path}? y/<%=3D color('N', BOLD) %>", true)
    {|q| q.default =3D false}

    ... The prompt is followed by a newline in irb/ruby. I can't see an
    option in the docs to change this behavior. I'm trying to emulate the
    question when copying a directory tree like the Rails command or its
    generators do.

    Some searching led me to think that the Termios gem may help, but if I
    try to install it (Ruby 1.9.2-p0), I get this:


    termios.c: In function =91Termios_to_termios=92:
    termios.c:182: error: =91struct RArray=92 has no member named =91ptr=92
    termios.c:183: error: =91struct RArray=92 has no member named =91ptr=92
    termios.c: In function =91termios_tcgetattr=92:
    termios.c:200: error: =91OpenFile=92 undeclared (first use in this function=
    )
    termios.c:200: error: (Each undeclared identifier is reported only once
    termios.c:200: error: for each function it appears in.)
    termios.c:200: error: =91fptr=92 undeclared (first use in this function)
    termios.c: In function =91termios_tcsetattr=92:
    termios.c:224: error: =91OpenFile=92 undeclared (first use in this function=
    )
    termios.c:224: error: =91fptr=92 undeclared (first use in this function)
    termios.c:231: warning: initialization discards qualifiers from
    pointer target type
    termios.c: In function =91termios_tcsendbreak=92:
    termios.c:265: error: =91OpenFile=92 undeclared (first use in this function=
    )
    termios.c:265: error: =91fptr=92 undeclared (first use in this function)
    termios.c: In function =91termios_tcdrain=92:
    termios.c:290: error: =91OpenFile=92 undeclared (first use in this function=
    )
    termios.c:290: error: =91fptr=92 undeclared (first use in this function)
    termios.c: In function =91termios_tcflush=92:
    termios.c:313: error: =91OpenFile=92 undeclared (first use in this function=
    )
    termios.c:313: error: =91fptr=92 undeclared (first use in this function)
    termios.c: In function =91termios_tcflow=92:
    termios.c:343: error: =91OpenFile=92 undeclared (first use in this function=
    )
    termios.c:343: error: =91fptr=92 undeclared (first use in this function)
    termios.c: In function =91termios_tcgetpgrp=92:
    termios.c:374: error: =91OpenFile=92 undeclared (first use in this function=
    )
    termios.c:374: error: =91fptr=92 undeclared (first use in this function)
    termios.c: In function =91termios_tcsetpgrp=92:
    termios.c:398: error: =91OpenFile=92 undeclared (first use in this function=
    )
    termios.c:398: error: =91fptr=92 undeclared (first use in this function)
    make: *** [termios.o] Error 1

    Thanks (Snow Leopard, BTW)



    Cheers,
    Ed

    Ed Howland
    http://greenprogrammer.wordpress.com
    http://twitter.com/ed_howland
     
    Ed Howland, Oct 10, 2010
    #1
    1. Advertisements

  2. You just want to take the answer on the same line? Add some space after =
    the prompt (at the end of your bold N) and HighLine should do the right =
    thing for you.

    Hope that helps.

    James Edward Gray II=
     
    James Edward Gray II, Oct 10, 2010
    #2
    1. Advertisements

  3. Ed Howland

    Ed Howland Guest

    Ed Howland, Oct 10, 2010
    #3
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.