diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-02-06 00:16:50 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-02-06 00:16:50 +0000 |
| commit | c77a5ac4951c1c8cb6ed4934203746bf484f341b (patch) | |
| tree | 13513a51e38503ffdc81f573530942f7332f7027 /lib/irb | |
| parent | 7aa0ff1c7fe6fe26912f9c04397565269ea48f6b (diff) | |
| download | ruby-c77a5ac4951c1c8cb6ed4934203746bf484f341b.tar.gz ruby-c77a5ac4951c1c8cb6ed4934203746bf484f341b.tar.xz ruby-c77a5ac4951c1c8cb6ed4934203746bf484f341b.zip | |
* lib/irb/extend-command.rb: add irb_help command. [ruby-talk:91610]
* lib/irb/cmd/help.rb (IRB::ExtendCommand::Help): show RDoc.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@5626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/irb')
| -rw-r--r-- | lib/irb/cmd/help.rb | 23 | ||||
| -rw-r--r-- | lib/irb/extend-command.rb | 3 |
2 files changed, 26 insertions, 0 deletions
diff --git a/lib/irb/cmd/help.rb b/lib/irb/cmd/help.rb new file mode 100644 index 000000000..73067f53c --- /dev/null +++ b/lib/irb/cmd/help.rb @@ -0,0 +1,23 @@ +require 'rdoc/ri/ri_driver' + +module IRB + module ExtendCommand + module Help + begin + @ri = RiDriver.new + rescue SystemExit + else + def self.execute(context, *names) + names.each do |name| + begin + @ri.get_info_for(name.to_s) + rescue RiError + puts $!.message + end + end + nil + end + end + end + end +end diff --git a/lib/irb/extend-command.rb b/lib/irb/extend-command.rb index cfb2c7c4b..491aa027c 100644 --- a/lib/irb/extend-command.rb +++ b/lib/irb/extend-command.rb @@ -100,6 +100,9 @@ module IRB [:fg, NO_OVERRIDE]], [:irb_kill, :Kill, "irb/cmd/subirb", [:kill, OVERRIDE_PRIVATE_ONLY]], + + [:irb_help, :Help, "irb/cmd/help", + [:help, NO_OVERRIDE]], ] def EXCB.install_extend_commands |
