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

Fix the superficial slop errors

This commit is contained in:
Conrad Irwin 2012-05-27 01:36:41 -07:00
parent 6bd1627022
commit e073092e7c
6 changed files with 41 additions and 41 deletions

View file

@ -37,10 +37,10 @@ class Pry
BANNER
def options(opt)
opt.on :e, :ex, "Open the file that raised the most recent exception (_ex_.file)", :optional => true, :as => Integer
opt.on :i, :in, "Open a temporary file containing the Nth line of _in_. N may be a range.", :optional => true, :as => Range, :default => -1..-1
opt.on :e, :ex, "Open the file that raised the most recent exception (_ex_.file)", :optional_argument => true, :as => Integer
opt.on :i, :in, "Open a temporary file containing the Nth line of _in_. N may be a range.", :optional_argument => true, :as => Range, :default => -1..-1
opt.on :t, :temp, "Open an empty temporary file"
opt.on :l, :line, "Jump to this line in the opened file", true, :as => Integer
opt.on :l, :line, "Jump to this line in the opened file", :argument => true, :as => Integer
opt.on :n, :"no-reload", "Don't automatically reload the edited code"
opt.on :c, :"current", "Open the current __FILE__ and at __LINE__ (as returned by `whereami`)."
opt.on :r, :reload, "Reload the edited code immediately (default for ruby files)"
@ -289,7 +289,7 @@ class Pry
create_command(/amend-line(?: (-?\d+)(?:\.\.(-?\d+))?)?/) do
description "Amend a line of input in multi-line mode."
command_options :interpolate => false, :listing => "amend-line"
command_options :interpolate => false, :listing => "-line"
banner <<-'BANNER'
Amend a line of input in multi-line mode. `amend-line N`, where the N in `amend-line N` represents line to replace.
@ -354,26 +354,26 @@ class Pry
end
def options(opt)
opt.on :m, :method, "Play a method's source.", true do |meth_name|
opt.on :m, :method, "Play a method's source.", :argument => true do |meth_name|
meth = get_method_or_raise(meth_name, target, {})
self.content << meth.source
end
opt.on :d, :doc, "Play a method's documentation.", true do |meth_name|
opt.on :d, :doc, "Play a method's documentation.", :argument => true do |meth_name|
meth = get_method_or_raise(meth_name, target, {})
text.no_color do
self.content << process_comment_markup(meth.doc, :ruby)
end
end
opt.on :c, :command, "Play a command's source.", true do |command_name|
opt.on :c, :command, "Play a command's source.", :argument => true do |command_name|
command = find_command(command_name)
block = Pry::Method.new(command.block)
self.content << block.source
end
opt.on :f, :file, "Play a file.", true do |file|
opt.on :f, :file, "Play a file.", :argument => true do |file|
self.content << File.read(File.expand_path(file))
end
opt.on :l, :lines, "Only play a subset of lines.", :optional => true, :as => Range, :default => 1..-1
opt.on :i, :in, "Play entries from Pry's input expression history. Takes an index or range. Note this can only replay pure Ruby code, not Pry commands.", :optional => true,
opt.on :l, :lines, "Only play a subset of lines.", :optional_argument => true, :as => Range, :default => 1..-1
opt.on :i, :in, "Play entries from Pry's input expression history. Takes an index or range. Note this can only replay pure Ruby code, not Pry commands.", :optional_argument => true,
:as => Range, :default => -5..-1 do |range|
input_expressions = _pry_.input_array[range] || []
Array(input_expressions).each { |v| self.content << v }

View file

@ -16,13 +16,13 @@ class Pry
USAGE
def options(opt)
opt.on :H, :head, "Display the first N items.", :optional => true, :as => Integer
opt.on :T, :tail, "Display the last N items.", :optional => true, :as => Integer
opt.on :s, :show, "Show the given range of lines.", :optional => true, :as => Range
opt.on :G, :grep, "Show lines matching the given pattern.", true, :as => String
opt.on :H, :head, "Display the first N items.", :optional_argument => true, :as => Integer
opt.on :T, :tail, "Display the last N items.", :optional_argument => true, :as => Integer
opt.on :s, :show, "Show the given range of lines.", :optional_argument => true, :as => Range
opt.on :G, :grep, "Show lines matching the given pattern.", :argument => true, :as => String
opt.on :c, :clear, "Clear the current session's history."
opt.on :r, :replay, "Replay a line or range of lines.", true, :as => Range
opt.on :save, "Save history to a file.", true, :as => Range
opt.on :r, :replay, "Replay a line or range of lines.", :argument => true, :as => Range
opt.on :save, "Save history to a file.", :argument => true, :as => Range
opt.on :e, :'exclude-pry', "Exclude Pry commands from the history."
opt.on :n, :'no-numbers', "Omit line numbers."

View file

@ -64,36 +64,36 @@ class Pry
end
def options(opt)
opt.on :m, :method, "Gist a method's source.", true do |meth_name|
opt.on :m, :method, "Gist a method's source.", :argument => true do |meth_name|
meth = get_method_or_raise(meth_name, target, {})
self.content << meth.source << "\n"
self.code_type = meth.source_type
end
opt.on :d, :doc, "Gist a method's documentation.", true do |meth_name|
opt.on :d, :doc, "Gist a method's documentation.", :argument => true do |meth_name|
meth = get_method_or_raise(meth_name, target, {})
text.no_color do
self.content << process_comment_markup(meth.doc, self.code_type) << "\n"
end
self.code_type = :plain
end
opt.on :c, :command, "Gist a command's source.", true do |command_name|
opt.on :c, :command, "Gist a command's source.", :argument => true do |command_name|
command = find_command(command_name)
block = Pry::Method.new(command.block)
self.content << block.source << "\n"
end
opt.on :k, :class, "Gist a class's source.", true do |class_name|
opt.on :k, :class, "Gist a class's source.", :argument => true do |class_name|
mod = Pry::WrappedModule.from_str(class_name, target)
self.content << mod.source << "\n"
end
opt.on :hist, "Gist a range of Readline history lines.", :optional => true, :as => Range, :default => -20..-1 do |range|
opt.on :hist, "Gist a range of Readline history lines.", :optional_argument => true, :as => Range, :default => -20..-1 do |range|
h = Pry.history.to_a
self.content << h[one_index_range(convert_to_range(range))].join("\n") << "\n"
end
opt.on :f, :file, "Gist a file.", true do |file|
opt.on :f, :file, "Gist a file.", :argument => true do |file|
self.content << File.read(File.expand_path(file)) << "\n"
end
opt.on :o, :out, "Gist entries from Pry's output result history. Takes an index or range.", :optional => true,
opt.on :o, :out, "Gist entries from Pry's output result history. Takes an index or range.", :optional_argument => true,
:as => Range, :default => -5..-1 do |range|
range = convert_to_range(range)
@ -103,12 +103,12 @@ class Pry
self.content << "\n"
end
# opt.on :s, :string, "Gist a string", true do |string|
# opt.on :s, :string, "Gist a string", :argument => true do |string|
# self.content << string << "\n"
# end
opt.on :p, :public, "Create a public gist (default: false)", :default => false
opt.on :l, :lines, "Only gist a subset of lines.", :optional => true, :as => Range, :default => 1..-1
opt.on :i, :in, "Gist entries from Pry's input expression history. Takes an index or range.", :optional => true,
opt.on :l, :lines, "Only gist a subset of lines.", :optional_argument => true, :as => Range, :default => 1..-1
opt.on :i, :in, "Gist entries from Pry's input expression history. Takes an index or range.", :optional_argument => true,
:as => Range, :default => -5..-1 do |range|
range = convert_to_range(range)
input_expressions = _pry_.input_array[range] || []
@ -206,24 +206,24 @@ class Pry
end
def options(opt)
opt.on :m, :method, "Save a method's source.", true do |meth_name|
opt.on :m, :method, "Save a method's source.", :argument => true do |meth_name|
meth = get_method_or_raise(meth_name, target, {})
self.content << meth.source
end
opt.on :k, :class, "Save a class's source.", true do |class_name|
opt.on :k, :class, "Save a class's source.", :argument => true do |class_name|
mod = Pry::WrappedModule.from_str(class_name, target)
self.content << mod.source
end
opt.on :c, :command, "Save a command's source.", true do |command_name|
opt.on :c, :command, "Save a command's source.", :argument => true do |command_name|
command = find_command(command_name)
block = Pry::Method.new(command.block)
self.content << block.source
end
opt.on :f, :file, "Save a file.", true do |file|
opt.on :f, :file, "Save a file.", :argument => true do |file|
self.content << File.read(File.expand_path(file))
end
opt.on :l, :lines, "Only save a subset of lines.", :optional => true, :as => Range, :default => 1..-1
opt.on :o, :out, "Save entries from Pry's output result history. Takes an index or range.", :optional => true,
opt.on :l, :lines, "Only save a subset of lines.", :optional_argument => true, :as => Range, :default => 1..-1
opt.on :o, :out, "Save entries from Pry's output result history. Takes an index or range.", :optional_argument => true,
:as => Range, :default => -5..-1 do |range|
range = convert_to_range(range)
@ -233,7 +233,7 @@ class Pry
self.content << "\n"
end
opt.on :i, :in, "Save entries from Pry's input expression history. Takes an index or range.", :optional => true,
opt.on :i, :in, "Save entries from Pry's input expression history. Takes an index or range.", :optional_argument => true,
:as => Range, :default => -5..-1 do |range|
input_expressions = _pry_.input_array[range] || []
Array(input_expressions).each { |v| self.content << v }
@ -289,13 +289,13 @@ class Pry
USAGE
def options(opt)
opt.on :ex, "Show the context of the last exception.", :optional => true, :as => Integer
opt.on :i, :in, "Show one or more entries from Pry's expression history.", :optional => true, :as => Range, :default => -5..-1
opt.on :ex, "Show the context of the last exception.", :optional_argument => true, :as => Integer
opt.on :i, :in, "Show one or more entries from Pry's expression history.", :optional_argument => true, :as => Range, :default => -5..-1
opt.on :s, :start, "Starting line (defaults to the first line).", :optional => true, :as => Integer
opt.on :e, :end, "Ending line (defaults to the last line).", :optional => true, :as => Integer
opt.on :s, :start, "Starting line (defaults to the first line).", :optional_argument => true, :as => Integer
opt.on :e, :end, "Ending line (defaults to the last line).", :optional_argument => true, :as => Integer
opt.on :l, :'line-numbers', "Show line numbers."
opt.on :t, :type, "The file type for syntax highlighting (e.g., 'ruby' or 'python').", true, :as => Symbol
opt.on :t, :type, "The file type for syntax highlighting (e.g., 'ruby' or 'python').", :argument => true, :as => Symbol
opt.on :f, :flood, "Do not use a pager to view text longer than one screen."
end

View file

@ -35,7 +35,7 @@ class Pry
opt.on :i, "ivars", "Show instance variables (in blue) and class variables (in bright blue)"
opt.on :G, "grep", "Filter output by regular expression", :optional => false
opt.on :G, "grep", "Filter output by regular expression", :argument => true
if jruby?
opt.on :J, "all-java", "Show all the aliases for methods from java (default is to show only prettiest)"
end

View file

@ -9,7 +9,7 @@ class Pry
opt.on :M, "instance-methods", "Operate on instance methods."
opt.on :m, :methods, "Operate on methods."
opt.on :s, :super, "Select the 'super' method. Can be repeated to traverse the ancestors.", :as => :count
opt.on :c, :context, "Select object context to run under.", true do |context|
opt.on :c, :context, "Select object context to run under.", :argument => true do |context|
@method_target = Pry.binding_for(target.eval(context))
end
end

View file

@ -213,7 +213,7 @@ describe "Pry::Command" do
it 'should provide opts and args as provided by slop' do
cmd = @set.create_command 'lintilla', "One of 800,000,000 clones" do
def options(opt)
opt.on :f, :four, "A numeric four", :as => Integer, :optional => true
opt.on :f, :four, "A numeric four", :as => Integer, :optional_argument => true
end
def process