Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove newline from ask method in Highline library?

Tags:

ruby

highline

I need a way to remove the newline from the ask method included in highline. Here's my current code:

pass = ask( "Enter your password > " ) { |passman| passman.echo = false }

But whenever I run the that, the output is

Enter your password > 
(typing goes here)

and I wish for this to not have a newline character. Any suggestions?

like image 843
Mark Avatar asked May 14 '11 21:05

Mark


1 Answers

doc: highline says:

If the provided statement ends with a space or tab character, a newline will not be appended (output will be flush()ed).

So try it with a space:

pass = ask( "Enter your password > " ) { |passman| passman.echo = false }
like image 102
sawa Avatar answered Sep 28 '22 07:09

sawa