Highline and Termios issues

Hi,

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

    agree("overwite #{path}? y/<%= color('N', BOLD) %>", true)

{|q| q.default = 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 ‘Termios_to_termios’:
termios.c:182: error: ‘struct RArray’ has no member named ‘ptr’
termios.c:183: error: ‘struct RArray’ has no member named ‘ptr’
termios.c: In function ‘termios_tcgetattr’:
termios.c:200: error: ‘OpenFile’ 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: ‘fptr’ undeclared (first use in this function)
termios.c: In function ‘termios_tcsetattr’:
termios.c:224: error: ‘OpenFile’ undeclared (first use in this function)
termios.c:224: error: ‘fptr’ undeclared (first use in this function)
termios.c:231: warning: initialization discards qualifiers from
pointer target type
termios.c: In function ‘termios_tcsendbreak’:
termios.c:265: error: ‘OpenFile’ undeclared (first use in this function)
termios.c:265: error: ‘fptr’ undeclared (first use in this function)
termios.c: In function ‘termios_tcdrain’:
termios.c:290: error: ‘OpenFile’ undeclared (first use in this function)
termios.c:290: error: ‘fptr’ undeclared (first use in this function)
termios.c: In function ‘termios_tcflush’:
termios.c:313: error: ‘OpenFile’ undeclared (first use in this function)
termios.c:313: error: ‘fptr’ undeclared (first use in this function)
termios.c: In function ‘termios_tcflow’:
termios.c:343: error: ‘OpenFile’ undeclared (first use in this function)
termios.c:343: error: ‘fptr’ undeclared (first use in this function)
termios.c: In function ‘termios_tcgetpgrp’:
termios.c:374: error: ‘OpenFile’ undeclared (first use in this function)
termios.c:374: error: ‘fptr’ undeclared (first use in this function)
termios.c: In function ‘termios_tcsetpgrp’:
termios.c:398: error: ‘OpenFile’ undeclared (first use in this function)
termios.c:398: error: ‘fptr’ undeclared (first use in this function)
make: *** [termios.o] Error 1

Thanks (Snow Leopard, BTW)

Cheers,
Ed

Ed Howland


http://twitter.com/ed_howland

On Oct 10, 2010, at 3:11 PM, Ed Howland wrote:

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

   agree("overwite #{path}? y/<%= color('N', BOLD) %>", true)

{|q| q.default = false}

… The prompt is followed by a newline in irb/ruby. I can’t see an
option in the docs to change this behavior.

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 G. II

Thanks James.

Cheers,
Ed

Ed Howland
http://greenprogrammer.wordpress.com
http://twitter.com/ed_howland

On Sun, Oct 10, 2010 at 4:22 PM, James Edward G. II

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs