1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Make parse_options! abort the command if --help is passed

This commit is contained in:
Conrad Irwin 2011-10-15 01:08:53 -07:00
parent f72228bd1c
commit ffce50a392
4 changed files with 5 additions and 6 deletions

View file

@ -168,7 +168,10 @@ class Pry
context.command_processor = self
ret = commands.run_command(context, command, *args)
ret = nil
catch(:command_done) do
ret = commands.run_command(context, command, *args)
end
options[:val].replace("")

View file

@ -19,7 +19,6 @@ class Pry
opt.on :f, :flood, "Do not use a pager to view text longer than one screen."
end
next if opts.help?
meth = opts[:method_object]
raise Pry::CommandError, "No documentation found." if meth.doc.nil? || meth.doc.empty?
@ -44,7 +43,6 @@ class Pry
e.g: stat hello_method
USAGE
end
next if opts.help?
meth = opts[:method_object]
output.puts unindent <<-EOS
@ -77,7 +75,6 @@ class Pry
opt.on :d, :doc, "Gist a method's documentation."
opt.on :p, :private, "Create a private gist (default: true)", :default => true
end
next if opts.help?
meth = opts[:method_object]
type_map = { :ruby => "rb", :c => "c", :plain => "plain" }

View file

@ -17,7 +17,6 @@ class Pry
opt.on :b, "base-one", "Show line numbers but start numbering at 1 (useful for `amend-line` and `play` commands)."
opt.on :f, :flood, "Do not use a pager to view text longer than one screen."
end
next if opts.help?
meth = opts[:method_object]
@ -216,7 +215,6 @@ class Pry
output.puts opt
end
end
next if opts.help?
if !Pry.config.editor
raise CommandError, "No editor set!\nEnsure that #{text.bold("Pry.config.editor")} is set to your editor of choice."

View file

@ -21,6 +21,7 @@ class Pry
yield opt
opt.on :h, :help, "This message" do
output.puts opt
throw :command_done
end
end.tap do |opts|