Comments (11)
Thanks for reporting it @asfaltboy !
Could you please clone the repo and post here the results of bundle exec rake acceptance
from highline.
What is the output of
cli = HighLine.new
size = cli.terminal.terminal_size
from highline.
Output of `bundle exec rake acceptance`
=====
at_readline.rb
=====
This step checks if the readline autocomplete feature is working.
The test has 5 options you can choose from: save, sample, exec, exit and load.
If you type the first character of one of them and then press
the <TAB> key you should see the options available for autocomplete.
For example, if I type 's' and then I press <TAB> I should see a list
with 'save' and 'sample' as possible options for autocomplete.
Although, if I type 'l' and then press the <TAB> key it should be
readly autcompleted as 'load', because 'load' is the only option
that begins with the 'l' letter in this particular case.
If I don't type any character but press <TAB> two times, I should
be able to see ALL available options.
Please, play with Readline autocomplete for a while, pressing <ENTER>
to see that it really gets the selected answer.
When ready, just type 'exit' and the loop will finish.
Don't forget to answer 'y' (yes) or 'n' (no) to the question at the end.
---
Enter command: rake aborted!
LoadError: dlopen(/Users/pavel.savchenko/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/x86_64-darwin17/readline.bundle, 9): Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib
Referenced from: /Users/pavel.savchenko/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/x86_64-darwin17/readline.bundle
Reason: image not found - /Users/pavel.savchenko/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/x86_64-darwin17/readline.bundle
/Users/pavel.savchenko/github/highline/lib/highline/terminal.rb:99:in `require'
/Users/pavel.savchenko/github/highline/lib/highline/terminal.rb:99:in `get_line_with_readline'
/Users/pavel.savchenko/github/highline/lib/highline/terminal.rb:88:in `get_line'
/Users/pavel.savchenko/github/highline/lib/highline.rb:532:in `get_line'
/Users/pavel.savchenko/github/highline/lib/highline.rb:516:in `get_response_line_mode'
/Users/pavel.savchenko/github/highline/lib/highline/question.rb:524:in `get_response'
/Users/pavel.savchenko/github/highline/lib/highline/question.rb:536:in `get_response_or_default'
/Users/pavel.savchenko/github/highline/lib/highline/question_asker.rb:30:in `ask_once'
/Users/pavel.savchenko/github/highline/lib/highline.rb:223:in `ask'
/Users/pavel.savchenko/github/highline/test/acceptance/at_readline.rb:28:in `block (3 levels) in <top (required)>'
/Users/pavel.savchenko/github/highline/test/acceptance/at_readline.rb:26:in `loop'
/Users/pavel.savchenko/github/highline/test/acceptance/at_readline.rb:26:in `block (2 levels) in <top (required)>'
/Users/pavel.savchenko/github/highline/test/acceptance/acceptance_test.rb:57:in `check'
/Users/pavel.savchenko/github/highline/test/acceptance/acceptance_test.rb:19:in `check'
/Users/pavel.savchenko/github/highline/test/acceptance/at_readline.rb:5:in `<top (required)>'
test/acceptance/acceptance.rb:11:in `load'
test/acceptance/acceptance.rb:11:in `block in <top (required)>'
test/acceptance/acceptance.rb:11:in `each'
test/acceptance/acceptance.rb:11:in `<top (required)>'
/Users/pavel.savchenko/github/highline/Rakefile:17:in `load'
/Users/pavel.savchenko/github/highline/Rakefile:17:in `block in <top (required)>'
/Users/pavel.savchenko/.rvm/gems/ruby-2.4.1/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
/Users/pavel.savchenko/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `eval'
/Users/pavel.savchenko/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => acceptance
(See full trace by running task with --trace)
Looks like I had an issue with readline, if this is anything like Python, I don't trust MacOS upgrade to not break dependencies, so I'll go ahead and re-install ruby 2.4.1, and report back once done.
from highline.
Hmmm, that didn't work. Interestingly enough when running the command above in irb
it works fine:
$ irb -rhighline 4346ms Wed Feb 20 21:19:45 2019
irb(main):001:0> cli = HighLine.new
=> #<HighLine:0x007fa24502b9f0 @input=#<IO:<STDIN>>, @output=#<IO:<STDOUT>>, @multi_indent=true, @indent_size=3, @indent_level=0, @wrap_at=nil, @page_at=nil, @header=nil, @prompt=nil, @key=nil, @use_color=true, @track_eof=true, @terminal=#<HighLine::Terminal::IOConsole:0x007fa24502b680 @input=#<IO:<STDIN>>, @output=#<IO:<STDOUT>>>>
irb(main):002:0> size = cli.terminal.terminal_size
But when running the same from bro.rb
I see that terminal_size
is nil, here is the relevant code:
sep = ""
cli = HighLine.new
p cli
p cli.terminal
p cli.terminal.terminal_size
size = cli.terminal.terminal_size
p size
(size.first - 5).times { sep += "." }
sep += "\n"
And here is the result:
#<HighLine:0x007fd9bd0ad810 @input=#<IO:<STDIN>>, @output=#<IO:<STDOUT>>, @multi_indent=true, @indent_size=3, @indent_level=0, @wrap_at=nil, @page_at=nil, @header=nil, @prompt=nil, @key=nil, @use_color=true, @track_eof=true, @terminal=#
#<HighLine::Terminal::IOConsole:0x007fd9bd0ad220 @input=#<IO:<STDIN>>, @output=#<IO:<STDOUT>>>
nil
nil
error: undefined method `first' for nil:NilClass. Use --trace to view backtrace
I'm not really savvy in Ruby, so do please let me know what other info I should provide?
from highline.
Please, could you issue a puts HighLine::VERSION
just to be sure your environment is set right. Perhaps your fireing different highline versions when switching from your script to irb. Just a guess.
from highline.
Were already able to run bundle exec rake acceptance
.
I need that final report like this:
=== HighLine Acceptance Tests Report
Date: 2019-02-21 11:32:33 UTC
HighLine::VERSION: 2.0.1
Terminal: HighLine::Terminal::IOConsole
RUBY_DESCRIPTION: ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
Readline::VERSION: 7.0
ENV['SHELL']: /bin/bash
ENV['TERM']: xterm-256color
ENV['TERM_PROGRAM']: iTerm.app
from highline.
Sure
bundle exec bro gzip 259ms Thu Feb 21 15:03:00 2019
5 entries for gzip -- submit your own example with "bro add gzip"
2.0.1
#<HighLine:0x007fd1f80768c8 @input=#<IO:<STDIN>>, @output=#<IO:<STDOUT>>, @multi_indent=true, @indent_size=3, @indent_level=0, @wrap_at=nil, @page_at=nil, @header=nil, @prompt=nil, @key=nil, @use_color=true, @track_eof=true, @terminal=#
#<HighLine::Terminal::IOConsole:0x007fd1f80765d0 @input=#<IO:<STDIN>>, @output=#<IO:<STDOUT>>>
nil
nil
error: undefined method `first' for nil:NilClass. Use --trace to view backtrace
and
=== HighLine Acceptance Tests Report
Date: 2019-02-21 14:05:10 UTC
HighLine::VERSION: 2.0.1
Terminal: HighLine::Terminal::IOConsole
RUBY_DESCRIPTION: ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin18]
Readline::VERSION: 8.0
ENV['SHELL']: /usr/local/bin/fish
ENV['TERM']: screen-256color
ENV['TERM_PROGRAM']: iTerm.app
from highline.
Im so sorry I couldn't progress on this. Passing here just to let you know that I still care for your issue.
from highline.
No worries, let me know if you need more traces or debug logs, etc.
from highline.
def output_cols
return 80 unless @output.tty?
terminal.terminal_size.first
rescue NoMethodError
return 80
end
If terminal @output
is not a tty?
then terminal.terminal_size
should not return nil
.
I could just put a default fallback value for that (the same as I did for when it is not a tty?
).
Could you please check these lines and copy past the results here?
p STDIN.tty? # should be true
p STDIN.terminal_size # should be an array with 2 values (lines and cols size)
from highline.
@asfaltboy I'm reviewing the issues list.
Could you confirm this issue still exists?
I don't have High Sierra so I'm not able to reproduce it.
I'll be closing this, but feel free to comment or reopen it if it's still happening.
Thanks for reporting.
from highline.
Related Issues (20)
- can't modify frozen NilClass when using HighLine::Simulate HOT 5
- Docs not on RubyDoc.info as README states HOT 2
- Proc validation displays ruby object on invalid HOT 8
- Incosistent behavior when ask with a validator and readline=true HOT 9
- undefined method 'default_instance' HOT 3
- Default Highline Example on GithubGives Error HOT 5
- HighLine Terminal::IOConsole#restore_mode does not work with StringIO HOT 3
- System extensions depend on now-internalized JRuby dependencies HOT 14
- consider exposing Readline.completion_proc via HighLine::Question#selection HOT 3
- default value has to be a string HOT 14
- Ctrl-C improperly handled when q.echo = false HOT 6
- Issues with echo: false and not on TTY HOT 7
- echo=false or echo='*' requires extra character after enter on Windows HOT 6
- Possible to accept multiple selections with `.in` and `.default`? HOT 5
- test failing when ruby is built against libedit instead of readline HOT 3
- Have to set convert type in order for `.in` to work with array
- 2.1.0 was released, but tag is missing in repository HOT 2
- Make Highline Ruby 3.3 and reline compatible HOT 1
- Update tests for Reline (as the substitute of Readline)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from highline.