From 5539f3bebb8df76ad1347065b91ec42de7bc4b78 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Sat, 31 Dec 2011 14:40:44 +0000 Subject: [PATCH] Make help use Slop where possible --- lib/pry/command.rb | 7 +++++++ lib/pry/command_set.rb | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/pry/command.rb b/lib/pry/command.rb index 95d986b4..0a202757 100644 --- a/lib/pry/command.rb +++ b/lib/pry/command.rb @@ -197,6 +197,8 @@ class Pry args.values_at *(0..(arity - 1)).to_a end end + + def help; description; end end # A super-class ofr Commands with structure. @@ -232,6 +234,11 @@ class Pry end end + # Return the help generated by Slop for this command. + def help + slop.help + end + # Return an instance of Slop that can parse the options that this command accepts. def slop Slop.new do |opt| diff --git a/lib/pry/command_set.rb b/lib/pry/command_set.rb index 74001571..a56e766e 100644 --- a/lib/pry/command_set.rb +++ b/lib/pry/command_set.rb @@ -286,7 +286,7 @@ class Pry stagger_output(help_text) else if command = find_command(cmd) - output.puts command.description + output.puts command.new.help else output.puts "No info for command: #{cmd}" end