Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add help messages to show_source and show_doc commands #887

Merged
merged 2 commits into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion lib/irb/command/show_doc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,21 @@ def transform_args(args)
end

category "Context"
description "Enter the mode to look up RI documents."
description "Look up documentation with RI."

help_message <<~HELP_MESSAGE
Usage: show_doc [name]

When name is provided, IRB will look up the documentation for the given name.
When no name is provided, a RI session will be started.

Examples:

show_doc
show_doc Array
show_doc Array#each

HELP_MESSAGE

def execute(*names)
require 'rdoc/ri/driver'
Expand Down
16 changes: 15 additions & 1 deletion lib/irb/command/show_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,21 @@ module IRB
module Command
class ShowSource < Base
category "Context"
description "Show the source code of a given method or constant."
description "Show the source code of a given method, class/module, or constant."

help_message <<~HELP_MESSAGE
Usage: show_source [target] [-s]

-s Show the super method. You can stack it like `-ss` to show the super of the super, etc.

Examples:

show_source Foo
show_source Foo#bar
show_source Foo#bar -s
show_source Foo.baz
show_source Foo::BAR
HELP_MESSAGE

class << self
def transform_args(args)
Expand Down
Loading