help help --help to help

This commit is contained in:
Conrad Irwin 2012-01-14 23:31:58 -08:00
parent 696a2f1a82
commit 57424bc890
1 changed files with 27 additions and 14 deletions

View File

@ -331,8 +331,26 @@ class Pry
def define_default_commands
command "help", "This menu." do |cmd|
if !cmd
create_command "help" do |cmd|
description "Show a list of commands, or help for one command"
banner <<-BANNER
Usage: help [ COMMAND ]
With no arguments, help lists all the available commands in the current
command-set along with their description.
When given a command name as an argument, shows the help for that command.
BANNER
def process
if cmd = args.first
if command = find_command(cmd)
output.puts command.new.help
else
output.puts "No info for command: #{cmd}"
end
else
output.puts
help_text = heading("Command List: ") + "\n"
@ -343,11 +361,6 @@ class Pry
end.compact.sort.join("\n")
stagger_output(help_text)
else
if command = find_command(cmd)
output.puts command.new.help
else
output.puts "No info for command: #{cmd}"
end
end
end