Skip to content

Support ls command from irb#172

Closed
st0012 wants to merge 5 commits into
ruby:masterfrom
st0012:irb-command
Closed

Support ls command from irb#172
st0012 wants to merge 5 commits into
ruby:masterfrom
st0012:irb-command

Conversation

@st0012

@st0012 st0012 commented Jul 13, 2021

Copy link
Copy Markdown
Member

Implements #29

截圖 2021-07-13 下午11 15 17

Some notes:

  1. ls command can't disable coloring because irb's implementation seems to ignore the config. I'll open an issue in the irb repo later.

截圖 2021-07-13 下午11 17 52

  1. The current implementation should be able to support other irb commands (like show_source) with very few changes. But let's do that in another PR.

end
end

extend IRB::ExtendCommandBundle

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This module injects irb commands as methods. Pretty handy 👍
https://github.com/ruby/irb/blob/master/lib/irb/extend-command.rb

Comment thread lib/debug/session.rb
# * Executes `irb`'s `ls` command with the given obj.
when 'ls'
if @ui.remote?
@ui.puts "not supported on the remote console."

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason it can't run on remote console either. I think we can sort it out later.

end

def reset_irb_context
IRB.conf[:MAIN_CONTEXT] = nil

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is needed, but just in case.

@ko1

ko1 commented Jul 13, 2021

Copy link
Copy Markdown
Collaborator

Thanks, but I can't accept this PR because it introduced IRB's feature and I can't manage them.
ThreadClient should be enough small for maintenance and performance.

Can we copy the implementation from irb?

@ko1 ko1 closed this Jul 13, 2021
@st0012

st0012 commented Jul 13, 2021

Copy link
Copy Markdown
Member Author

ok.

@st0012 st0012 deleted the irb-command branch July 14, 2021 03:06
@st0012

st0012 commented Jul 14, 2021

Copy link
Copy Markdown
Member Author

@ko1 another implementation: #173

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants