ruby / ruby/irb

Consider letting help fall back to RI documentation

Open
#1,242 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
478
Forks
158
Avg merge
1d 12h
Merged PRs (30d)
12

Description

I noticed that:

irb> help Array
Can't find command `Array`. Please check the command name and try again.

even though IRB can already look up the same documentation with:

irb> show_doc Array

I dug into ShowDoc a bit and saw that it uses RDoc::RI::Driver, so it seems like help could potentially make use of the same functionality.

I'm wondering if it would make sense for help to fall back to RI when the requested name isn't an IRB command.

There seem to be two reasonable ways to handle this:

help Array could tell the user to use show_doc Array.
help Array could just display the RI documentation directly, effectively making help a more general entry point for both IRB commands and Ruby documentation.

The second option seems particularly convenient, but I wasn't sure which behavior would fit better with IRB's intended interface.

Would either of these be desirable? If so, I'd be interested in taking a shot at implementing it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the IRB help and show_doc entry points, then inspect how ShowDoc uses RDoc::RI::Driver. Resolve whether help should redirect users to show_doc or display RI documentation directly; done means the chosen behavior is implemented and covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.