diff --git a/lib/pry/commands/amend_line.rb b/lib/pry/commands/amend_line.rb index 90588af4..71ed5a50 100644 --- a/lib/pry/commands/amend_line.rb +++ b/lib/pry/commands/amend_line.rb @@ -6,13 +6,14 @@ class Pry command_options :interpolate => false, :listing => 'amend-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. + Amend a line of input in multi-line mode. `amend-line N`, where the N represents + line to replace. Can also specify a range of lines using `amend-line N..M` + syntax. Passing "!" as replacement content deletes the line(s) instead. - Can also specify a range of lines using `amend-line N..M` syntax. Passing '!' as replacement content deletes the line(s) instead. - e.g amend-line 1 puts 'hello world! # replace line 1' - e.g amend-line 1..4 ! # delete lines 1..4 - e.g amend-line 3 >puts 'goodbye' # insert before line 3 - e.g amend-line puts 'hello again' # no line number modifies immediately preceding line + amend-line 1 puts 'new' # replace line 1 + amend-line 1..4 ! # delete lines 1..4 + amend-line 3 >puts 'bye' # insert before line 3 + amend-line puts 'appended' # no line number modifies immediately preceding line BANNER def process diff --git a/lib/pry/commands/bang.rb b/lib/pry/commands/bang.rb index a73980fe..8047d6df 100644 --- a/lib/pry/commands/bang.rb +++ b/lib/pry/commands/bang.rb @@ -2,10 +2,14 @@ class Pry class Command::Bang < Pry::ClassCommand match '!' group 'Editing' - description 'Clear the input buffer. Useful if the parsing process goes ' \ - 'wrong and you get stuck in the read loop.' + description 'Clear the input buffer.' command_options :use_prefix => false + banner <<-'BANNER' + Clear the input buffer. Useful if the parsing process goes wrong and you get + stuck in the read loop. + BANNER + def process output.puts 'Input buffer cleared!' eval_string.replace('') diff --git a/lib/pry/commands/bang_pry.rb b/lib/pry/commands/bang_pry.rb index d5fdaca7..71f81ef1 100644 --- a/lib/pry/commands/bang_pry.rb +++ b/lib/pry/commands/bang_pry.rb @@ -2,8 +2,11 @@ class Pry class Command::BangPry < Pry::ClassCommand match '!pry' group 'Navigating Pry' - description 'Start a Pry session on current self; this even works mid ' \ - 'multi-line expression.' + description 'Start a Pry session on current self.' + + banner <<-'BANNER' + Start a Pry session on current self. Also works mid multi-line expression. + BANNER def process target.pry diff --git a/lib/pry/commands/cat.rb b/lib/pry/commands/cat.rb index 951072ca..a6f96267 100644 --- a/lib/pry/commands/cat.rb +++ b/lib/pry/commands/cat.rb @@ -7,29 +7,28 @@ class Pry match 'cat' group 'Input and Output' - description "Show code from a file, Pry's input buffer, or the last " \ - "exception." + description "Show code from a file, Pry's input buffer, or the last exception." - banner <<-USAGE + banner <<-'BANNER' Usage: cat FILE cat --ex [STACK_INDEX] cat --in [INPUT_INDEX_OR_RANGE] - cat is capable of showing part or all of a source file, the context of the + `cat` is capable of showing part or all of a source file, the context of the last exception, or an expression from Pry's input history. - cat --ex defaults to showing the lines surrounding the location of the last - exception. Invoking it more than once travels up the exception's backtrace, - and providing a number shows the context of the given index of the backtrace. - USAGE + `cat --ex` defaults to showing the lines surrounding the location of the last + exception. Invoking it more than once travels up the exception's backtrace, and + providing a number shows the context of the given index of the backtrace. + BANNER def options(opt) - 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_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').", :argument => true, :as => Symbol + 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_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')", :argument => true, :as => Symbol end def process diff --git a/lib/pry/commands/cd.rb b/lib/pry/commands/cd.rb index 10879430..95b9550d 100644 --- a/lib/pry/commands/cd.rb +++ b/lib/pry/commands/cd.rb @@ -4,18 +4,17 @@ class Pry group 'Context' description 'Move into a new context (object or scope).' - banner <<-BANNER + banner <<-'BANNER' Usage: cd [OPTIONS] [--help] - Move into new context (object or scope). As in unix shells use - `cd ..` to go back, `cd /` to return to Pry top-level and `cd -` - to toggle between last two scopes). - Complex syntax (e.g `cd ../@x/y`) also supported. + Move into new context (object or scope). As in UNIX shells use `cd ..` to go + back, `cd /` to return to Pry top-level and `cd -` to toggle between last two + scopes. Complex syntax (e.g `cd ../@x/y`) also supported. - e.g: `cd @x` - e.g: `cd ..` - e.g: `cd /` - e.g: `cd -` + cd @x + cd .. + cd / + cd - https://github.com/pry/pry/wiki/State-navigation#wiki-Changing_scope BANNER diff --git a/lib/pry/commands/code_collector.rb b/lib/pry/commands/code_collector.rb index 348311a2..694926d8 100644 --- a/lib/pry/commands/code_collector.rb +++ b/lib/pry/commands/code_collector.rb @@ -14,13 +14,15 @@ class Pry # Add the `--lines`, `-o`, `-i`, `-s`, `-d` options. def self.inject_options(opt) - opt.on :l, :lines, "Restrict to a subset of lines. Takes a line number or range.", :optional_argument => true, :as => Range, :default => 1..-1 - opt.on :o, :out, "Select lines from Pry's output result history. Takes an index or range.", :optional_argument => true, - :as => Range, :default => -5..-1 - opt.on :i, :in, "Select lines from Pry's input expression history. Takes an index or range.", :optional_argument => true, - :as => Range, :default => -5..-1 - opt.on :s, :super, "Select the 'super' method. Can be repeated to traverse the ancestors.", :as => :count - opt.on :d, :doc, "Select lines from the code object's documentation." + opt.on :l, :lines, "Restrict to a subset of lines. Takes a line number or range", + :optional_argument => true, :as => Range, :default => 1..-1 + opt.on :o, :out, "Select lines from Pry's output result history. Takes an index or range", + :optional_argument => true, :as => Range, :default => -5..-1 + opt.on :i, :in, "Select lines from Pry's input expression history. Takes an index or range", + :optional_argument => true, :as => Range, :default => -5..-1 + opt.on :s, :super, "Select the 'super' method. Can be repeated to traverse the ancestors", + :as => :count + opt.on :d, :doc, "Select lines from the code object's documentation" end # The content (i.e code/docs) for the selected object. diff --git a/lib/pry/commands/disable_pry.rb b/lib/pry/commands/disable_pry.rb index 7d187e6a..69bfc4e8 100644 --- a/lib/pry/commands/disable_pry.rb +++ b/lib/pry/commands/disable_pry.rb @@ -4,15 +4,15 @@ class Pry group 'Navigating Pry' description 'Stops all future calls to pry and exits the current session.' - banner <<-BANNER + banner <<-'BANNER' Usage: disable-pry - After this command is run any further calls to pry will immediately return - `nil` without interrupting the flow of your program. This is particularly - useful when you've debugged the problem you were having, and now wish the - program to run to the end. + After this command is run any further calls to pry will immediately return `nil` + without interrupting the flow of your program. This is particularly useful when + you've debugged the problem you were having, and now wish the program to run to + the end. - As alternatives, consider using `exit!` to force the current ruby process + As alternatives, consider using `exit!` to force the current Ruby process to quit immediately; or using `edit-method -p` to remove the `binding.pry` from the code. BANNER diff --git a/lib/pry/commands/edit.rb b/lib/pry/commands/edit.rb index ddf9ab47..e3eb1930 100644 --- a/lib/pry/commands/edit.rb +++ b/lib/pry/commands/edit.rb @@ -14,31 +14,34 @@ class Pry group 'Editing' description 'Invoke the default editor on a file.' - banner <<-BANNER + banner <<-'BANNER' Usage: edit [--no-reload|--reload|--patch] [--line LINE] [--temp|--ex|FILE[:LINE]|OBJECT|--in N] - Open a text editor. When no FILE is given, edits the pry input buffer. - Ensure Pry.config.editor is set to your editor of choice. + Open a text editor. When no FILE is given, edits the pry input buffer. Ensure + `Pry.config.editor` is set to your editor of choice. - e.g: `edit sample.rb` - e.g: `edit sample.rb --line 105` - e.g: `edit MyClass#my_method` - e.g: `edit -p MyClass#my_method` - e.g: `edit YourClass` - e.g: `edit --ex` + edit sample.rb + edit sample.rb --line 105 + edit MyClass#my_method + edit -p MyClass#my_method + edit YourClass + edit --ex` https://github.com/pry/pry/wiki/Editor-integration#wiki-Edit_command BANNER def options(opt) - 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 input expression. 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", :argument => true, :as => Integer + 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 input expression. 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", + :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)" - opt.on :p, :patch, "Instead of editing the object's file, try to edit in a tempfile and apply as a monkey patch." + 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)" + opt.on :p, :patch, "Instead of editing the object's file, try to edit in a tempfile and apply as a monkey patch" end def process diff --git a/lib/pry/commands/exit.rb b/lib/pry/commands/exit.rb index 982b2fe3..32c0c2ee 100644 --- a/lib/pry/commands/exit.rb +++ b/lib/pry/commands/exit.rb @@ -2,25 +2,23 @@ class Pry class Command::Exit < Pry::ClassCommand match 'exit' group 'Navigating Pry' - description 'Pop the previous binding (does NOT exit program). Aliases: quit' + description 'Pop the previous binding.' + command_options :keep_retval => true - banner <<-BANNER + banner <<-'BANNER' Usage: exit [OPTIONS] [--help] Aliases: quit - It can be useful to exit a context with a user-provided value. For - instance an exit value can be used to determine program flow. + Pop the previous binding (does NOT exit program). It can be useful to exit a + context with a user-provided value. For instance an exit value can be used to + determine program flow. - e.g: `exit "pry this"` - e.g: `exit` + exit "pry this" + exit https://github.com/pry/pry/wiki/State-navigation#wiki-Exit_with_value BANNER - command_options( - :keep_retval => true - ) - def process if _pry_.binding_stack.one? _pry_.run_command "exit-all #{arg_string}" diff --git a/lib/pry/commands/exit_all.rb b/lib/pry/commands/exit_all.rb index 52f4327b..1136de31 100644 --- a/lib/pry/commands/exit_all.rb +++ b/lib/pry/commands/exit_all.rb @@ -2,8 +2,15 @@ class Pry class Command::ExitAll < Pry::ClassCommand match 'exit-all' group 'Navigating Pry' - description 'End the current Pry session (popping all bindings) and ' \ - 'returning to caller. Accepts optional return value. Aliases: !!@' + description 'End the current Pry session.' + + banner <<-'BANNER' + Usage: exit-all [--help] + Aliases: !!@ + + End the current Pry session (popping all bindings and returning to caller). + Accepts optional return value. + BANNER def process # calculate user-given value diff --git a/lib/pry/commands/exit_program.rb b/lib/pry/commands/exit_program.rb index 50731b05..1e974ab8 100644 --- a/lib/pry/commands/exit_program.rb +++ b/lib/pry/commands/exit_program.rb @@ -2,7 +2,15 @@ class Pry class Command::ExitProgram < Pry::ClassCommand match 'exit-program' group 'Navigating Pry' - description 'End the current program. Aliases: quit-program, !!!' + description 'End the current program.' + + banner <<-'BANNER' + Usage: exit-program [--help] + Aliases: quit-program + !!! + + End the current program. + BANNER def process Pry.save_history if Pry.config.history.should_save diff --git a/lib/pry/commands/find_method.rb b/lib/pry/commands/find_method.rb index 565304cb..0bead171 100644 --- a/lib/pry/commands/find_method.rb +++ b/lib/pry/commands/find_method.rb @@ -4,20 +4,26 @@ class Pry match 'find-method' group 'Context' - options :requires_gem => 'ruby18_source_location' if mri_18? - options :shellwords => false + description 'Recursively search for a method within a Class/Module or the current namespace.' + command_options :shellwords => false + command_options :requires_gem => 'ruby18_source_location' if mri_18? - description 'Recursively search for a method within a Class/Module or the current namespace. find-method [-n | -c] METHOD [NAMESPACE]' - banner <<-BANNER - Usage: find-method [-n | -c] METHOD [NAMESPACE] + banner <<-'BANNER' + Usage: find-method [-n|-c] METHOD [NAMESPACE] Recursively search for a method within a Class/Module or the current namespace. - Use the `-n` switch (the default) to search for methods whose name matches the given regex. - Use the `-c` switch to search for methods that contain the given code. + Use the `-n` switch (the default) to search for methods whose name matches the + given regex. Use the `-c` switch to search for methods that contain the given + code. - e.g find-method re Pry # find all methods whose name match /re/ inside the Pry namespace. Matches Pry#repl, etc. - e.g find-method -c 'output.puts' Pry # find all methods that contain the code: output.puts inside the Pry namepsace. + # Find all methods whose name match /re/ inside + # the Pry namespace. Matches Pry#repl, etc. + find-method re Pry + + # Find all methods that contain the code: + # output.puts inside the Pry namepsace. + find-method -c 'output.puts' Pry BANNER def setup @@ -25,7 +31,7 @@ class Pry end def options(opti) - opti.on :n, :name, "Search for a method by name" + opti.on :n, :name, "Search for a method by name" opti.on :c, :content, "Search for a method based on content in Regex form" end diff --git a/lib/pry/commands/gem_cd.rb b/lib/pry/commands/gem_cd.rb index de0ae02e..da1907a6 100644 --- a/lib/pry/commands/gem_cd.rb +++ b/lib/pry/commands/gem_cd.rb @@ -5,10 +5,11 @@ class Pry description "Change working directory to specified gem's directory." command_options :argument_required => true - banner <<-BANNER + banner <<-'BANNER' Usage: gem-cd GEM_NAME - Change the current working directory to that in which the given gem is installed. + Change the current working directory to that in which the given gem is + installed. BANNER def process(gem) diff --git a/lib/pry/commands/gem_install.rb b/lib/pry/commands/gem_install.rb index 7b7df022..c724ac8d 100644 --- a/lib/pry/commands/gem_install.rb +++ b/lib/pry/commands/gem_install.rb @@ -5,10 +5,13 @@ class Pry description 'Install a gem and refresh the gem cache.' command_options :argument_required => true - banner <<-BANNER + banner <<-'BANNER' Usage: gem-install GEM_NAME - Installs the given gem and refreshes the gem cache so that you can immediately 'require GEM_FILE' + Installs the given gem and refreshes the gem cache so that you can immediately + 'require GEM_FILE'. + + gem-install pry-stack_explorer BANNER def setup diff --git a/lib/pry/commands/gem_list.rb b/lib/pry/commands/gem_list.rb index 0918d9ac..e4a5d00e 100644 --- a/lib/pry/commands/gem_list.rb +++ b/lib/pry/commands/gem_list.rb @@ -4,11 +4,11 @@ class Pry group 'Gems' description 'List and search installed gems.' - banner <<-BANNER + banner <<-'BANNER' Usage: gem-list [REGEX] - List all installed gems, when a regex is provided, limit the output to those that - match the regex. + List all installed gems, when a regex is provided, limit the output to those + that match the regex. BANNER def process(pattern = nil) diff --git a/lib/pry/commands/gem_open.rb b/lib/pry/commands/gem_open.rb index b5c16f14..1825ca1b 100644 --- a/lib/pry/commands/gem_open.rb +++ b/lib/pry/commands/gem_open.rb @@ -5,11 +5,13 @@ class Pry description 'Opens the working directory of the gem in your editor' command_options :argument_required => true - banner <<-BANNER + banner <<-'BANNER' Usage: gem-open GEM_NAME - Change the current working directory to that in which the given gem is installed, - and then opens your text editor. + Change the current working directory to that in which the given gem is + installed, and then opens your text editor. + + gem-open pry-exception_explorer BANNER def process(gem) diff --git a/lib/pry/commands/gist.rb b/lib/pry/commands/gist.rb index 39128e47..da4cb5d9 100644 --- a/lib/pry/commands/gist.rb +++ b/lib/pry/commands/gist.rb @@ -36,14 +36,15 @@ class Pry description Pry::Gist::DESCRIPTION command_options :requires_gem => 'jist', :shellwords => false - banner <<-USAGE + banner <<-BANNER Usage: gist [options] + #{Pry::Gist::DESCRIPTION} - If you'd like to associate your gists with your GitHub account, run: - gist --login + If you would like to associate your gists with your GitHub account, run + `gist --login`. - USAGE + BANNER banner << Pry::Gist.examples_docs << "\n" attr_accessor :content, :filename @@ -61,24 +62,24 @@ class Pry def options(opt) ext ='ruby' opt.on :login, "Authenticate the jist gem with GitHub" - opt.on :d, :doc, "Gist a method's documentation.", :argument => 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 @content << process_comment_markup(meth.doc) << "\n" end @filename = meth.source_file + ".doc" end - opt.on :m, :method, "Gist a method's source.", :argument => true do |meth_name| + opt.on :m, :method, "Gist a method's source", :argument => true do |meth_name| from_pry_api get_method_or_raise(meth_name, target, {}) end - opt.on :k, :command, "Gist a command's source.", :argument => true do |command_name| + opt.on :k, :command, "Gist a command's source", :argument => true do |command_name| command = find_command(command_name) from_pry_api Pry::Method.new(command.block) end - opt.on :c, :class, "Gist a class or module's source.", :argument => true do |class_name| + opt.on :c, :class, "Gist a class or module's source", :argument => true do |class_name| from_pry_api Pry::WrappedModule.from_str(class_name, target) end - opt.on :var, "Gist a variable's content.", :argument => true do |variable_name| + opt.on :var, "Gist a variable's content", :argument => true do |variable_name| begin obj = target.eval(variable_name) rescue Pry::RescuableException @@ -87,7 +88,7 @@ class Pry @content << Pry.config.gist.inspecter.call(obj) << "\n" end - opt.on :hist, "Gist a range of Readline history lines.", :optional_argument => 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 @content << h[one_index_range(convert_to_range(range))].join("\n") << "\n" end @@ -96,7 +97,7 @@ class Pry @content << File.read(File.expand_path(file)) << "\n" @filename = file end - opt.on :o, :out, "Gist entries from Pry's output result history. Takes an index or range.", :optional_argument => true, + opt.on :o, :out, "Gist entries from Pry's output result history. Takes an index or range", :optional_argument => true, :as => Range, :default => -1 do |range| range = convert_to_range(range) @@ -106,10 +107,10 @@ class Pry @content << "\n" end - opt.on :clip, "Copy the selected content to clipboard instead, do NOT gist it.", :default => false + opt.on :clip, "Copy the selected content to clipboard instead, do NOT gist it", :default => false opt.on :p, :public, "Create a public gist (default: false)", :default => false - opt.on :l, :lines, "Only gist a subset of lines from the gistable content.", :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, + opt.on :l, :lines, "Only gist a subset of lines from the gistable content", :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 => -1 do |range| range = convert_to_range(range) input_expressions = _pry_.input_array[range] || [] diff --git a/lib/pry/commands/help.rb b/lib/pry/commands/help.rb index 8ca03039..e6e4e198 100644 --- a/lib/pry/commands/help.rb +++ b/lib/pry/commands/help.rb @@ -2,15 +2,14 @@ class Pry class Command::Help < Pry::ClassCommand match 'help' group 'Help' - description 'Show a list of commands. Type `help ` for information about .' + description 'Show a list of commands or information about a specific command' - banner <<-BANNER - Usage: help [ 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. + command-set along with their description. When given a command name as an + argument, shows the help for that command. BANNER # We only want to show commands that have descriptions, so that the diff --git a/lib/pry/commands/hist.rb b/lib/pry/commands/hist.rb index 100b4623..e2444de0 100644 --- a/lib/pry/commands/hist.rb +++ b/lib/pry/commands/hist.rb @@ -2,31 +2,33 @@ class Pry class Command::Hist < Pry::ClassCommand match 'hist' group 'Editing' - description 'Show and replay Readline history. Aliases: history' + description 'Show and replay Readline history.' - banner <<-USAGE - Usage: hist - hist --head N - hist --tail N - hist --show START..END - hist --grep PATTERN - hist --clear - hist --replay START..END - hist --save [START..END] FILE - USAGE + banner <<-'BANNER' + Usage: hist [--head|--tail] + hist --head N + hist --tail N + hist --show START..END + hist --grep PATTERN + hist --clear + hist --replay START..END + hist --save [START..END] FILE + Aliases: history + + Show and replay Readline history. + BANNER def options(opt) - 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.", :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." - opt.on :f, :flood, "Do not use a pager to view text longer than one screen." + 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", :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" + opt.on :f, :flood, "Do not use a pager to view text longer than one screen" end def process diff --git a/lib/pry/commands/import_set.rb b/lib/pry/commands/import_set.rb index 472eb3c3..56898830 100644 --- a/lib/pry/commands/import_set.rb +++ b/lib/pry/commands/import_set.rb @@ -6,6 +6,10 @@ class Pry # of this command. description 'Import a Pry command set.' + banner <<-'BANNER' + Import a Pry command set. + BANNER + def process(command_set_name) raise CommandError, "Provide a command set name" if command_set.nil? diff --git a/lib/pry/commands/install_command.rb b/lib/pry/commands/install_command.rb index a2721e06..e5193adc 100644 --- a/lib/pry/commands/install_command.rb +++ b/lib/pry/commands/install_command.rb @@ -4,7 +4,7 @@ class Pry group 'Commands' description 'Install a disabled command.' - banner <<-BANNER + banner <<-'BANNER' Usage: install-command COMMAND Installs the gems necessary to run the given COMMAND. You will generally not diff --git a/lib/pry/commands/jump_to.rb b/lib/pry/commands/jump_to.rb index 2a489ec9..4179fc79 100644 --- a/lib/pry/commands/jump_to.rb +++ b/lib/pry/commands/jump_to.rb @@ -2,8 +2,11 @@ class Pry class Command::JumpTo < Pry::ClassCommand match 'jump-to' group 'Navigating Pry' - description 'Jump to a binding further up the stack, popping all ' \ - 'bindings below.' + description 'Jump to a binding further up the stack.' + + banner <<-'BANNER' + Jump to a binding further up the stack, popping all bindings below. + BANNER def process(break_level) break_level = break_level.to_i diff --git a/lib/pry/commands/ls.rb b/lib/pry/commands/ls.rb index 4df20c64..ba53635a 100644 --- a/lib/pry/commands/ls.rb +++ b/lib/pry/commands/ls.rb @@ -1,5 +1,5 @@ class Pry - module Helpers + module Helpers module Formatting def self.tablify(things, line_length) table = Table.new(things, :column_count => things.size) @@ -88,41 +88,44 @@ class Pry end end - - class Command::Ls < Pry::ClassCommand + + class Command::Ls < Pry::ClassCommand match 'ls' group 'Context' description 'Show the list of vars and methods in the current scope.' command_options :shellwords => false, :interpolate => false def options(opt) - opt.banner unindent <<-USAGE + opt.banner unindent <<-'BANNER' Usage: ls [-m|-M|-p|-pM] [-q|-v] [-c|-i] [Object] ls [-g] [-l] - ls shows you which methods, constants and variables are accessible to Pry. By default it shows you the local variables defined in the current shell, and any public methods or instance variables defined on the current object. + ls shows you which methods, constants and variables are accessible to Pry. By + default it shows you the local variables defined in the current shell, and any + public methods or instance variables defined on the current object. - The colours used are configurable using Pry.config.ls.*_color, and the separator is Pry.config.ls.separator. + The colours used are configurable using Pry.config.ls.*_color, and the separator + is Pry.config.ls.separator. - Pry.config.ls.ceiling is used to hide methods defined higher up in the inheritance chain, this is by default set to [Object, Module, Class] so that methods defined on all Objects are omitted. The -v flag can be used to ignore this setting and show all methods, while the -q can be used to set the ceiling much lower and show only methods defined on the object or its direct class. - USAGE + Pry.config.ls.ceiling is used to hide methods defined higher up in the + inheritance chain, this is by default set to [Object, Module, Class] so that + methods defined on all Objects are omitted. The -v flag can be used to ignore + this setting and show all methods, while the -q can be used to set the ceiling + much lower and show only methods defined on the object or its direct class. + BANNER - opt.on :m, "methods", "Show public methods defined on the Object (default)" + opt.on :m, :methods, "Show public methods defined on the Object (default)" opt.on :M, "instance-methods", "Show methods defined in a Module or Class" + opt.on :p, :ppp, "Show public, protected (in yellow) and private (in green) methods" + opt.on :q, :quiet, "Show only methods defined on object.singleton_class and object.class" + opt.on :v, :verbose, "Show methods and constants on all super-classes (ignores Pry.config.ls.ceiling)" + opt.on :g, :globals, "Show global variables, including those builtin to Ruby (in cyan)" + opt.on :l, :locals, "Show hash of local vars, sorted by descending size" + opt.on :c, :constants, "Show constants, highlighting classes (in blue), and exceptions (in purple).\n" + + " " * 32 + "Constants that are pending autoload? are also shown (in yellow)" + opt.on :i, :ivars, "Show instance variables (in blue) and class variables (in bright blue)" + opt.on :G, :grep, "Filter output by regular expression", :argument => true - opt.on :p, "ppp", "Show public, protected (in yellow) and private (in green) methods" - opt.on :q, "quiet", "Show only methods defined on object.singleton_class and object.class" - opt.on :v, "verbose", "Show methods and constants on all super-classes (ignores Pry.config.ls.ceiling)" - - opt.on :g, "globals", "Show global variables, including those builtin to Ruby (in cyan)" - opt.on :l, "locals", "Show hash of local vars, sorted by descending size" - - opt.on :c, "constants", "Show constants, highlighting classes (in blue), and exceptions (in purple).\n" + - " " * 32 + "Constants that are pending autoload? are also shown (in yellow)." - - opt.on :i, "ivars", "Show instance variables (in blue) and class variables (in bright blue)" - - 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 diff --git a/lib/pry/commands/nesting.rb b/lib/pry/commands/nesting.rb index bf59df4c..f9c0297c 100644 --- a/lib/pry/commands/nesting.rb +++ b/lib/pry/commands/nesting.rb @@ -4,6 +4,10 @@ class Pry group 'Navigating Pry' description 'Show nesting information.' + banner <<-'BANNER' + Show nesting information. + BANNER + def process output.puts 'Nesting status:' output.puts '--' diff --git a/lib/pry/commands/play.rb b/lib/pry/commands/play.rb index d14bd254..216ba425 100644 --- a/lib/pry/commands/play.rb +++ b/lib/pry/commands/play.rb @@ -2,19 +2,19 @@ class Pry class Command::Play < Pry::ClassCommand match 'play' group 'Editing' - description 'Play back a string variable or a method or a file as input.' + description 'Playback a string variable or a method or a file as input.' - banner <<-BANNER + banner <<-'BANNER' Usage: play [OPTIONS] [--help] - The play command enables you to replay code from files and methods as - if they were entered directly in the Pry REPL. Default action (no - options) is to play the provided string variable. + The play command enables you to replay code from files and methods as if they + were entered directly in the Pry REPL. Default action (no options) is to play + the provided string variable. - e.g: `play --lines 149..153` - e.g: `play -i 20 --lines 1..3` - e.g: `play Pry#repl --lines 1..-1` - e.g: `play Rakefile --lines 5` + play --lines 149..153 + play -i 20 --lines 1..3 + play Pry#repl --lines 1..-1 + play Rakefile --lines 5 https://github.com/pry/pry/wiki/User-Input#wiki-Play BANNER @@ -22,7 +22,9 @@ class Pry def options(opt) CodeCollector.inject_options(opt) - opt.on :open, "open", 'When used with the -m switch, it plays the entire method except the last line, leaving the method definition "open". `amend-line` can then be used to modify the method.' + opt.on :open, 'When used with the -m switch, it plays the entire method except' \ + ' the last line, leaving the method definition "open". `amend-line`' \ + ' can then be used to modify the method.' end def process diff --git a/lib/pry/commands/pry_backtrace.rb b/lib/pry/commands/pry_backtrace.rb index d8bcea58..d27a4816 100644 --- a/lib/pry/commands/pry_backtrace.rb +++ b/lib/pry/commands/pry_backtrace.rb @@ -5,16 +5,15 @@ class Pry description 'Show the backtrace for the Pry session.' banner <<-BANNER - Usage: pry-backtrace [OPTIONS] [--help] + Usage: pry-backtrace [OPTIONS] [--help] - Show the backtrace for the position in the code where Pry was started. This can be used to - infer the behavior of the program immediately before it entered Pry, just like the backtrace - property of an exception. + Show the backtrace for the position in the code where Pry was started. This can + be used to infer the behavior of the program immediately before it entered Pry, + just like the backtrace property of an exception. - (NOTE: if you are looking for the backtrace of the most recent exception raised, - just type: `_ex_.backtrace` instead, see https://github.com/pry/pry/wiki/Special-Locals) - - e.g: pry-backtrace + NOTE: if you are looking for the backtrace of the most recent exception raised, + just type: `_ex_.backtrace` instead. + See: https://github.com/pry/pry/wiki/Special-Locals BANNER def process diff --git a/lib/pry/commands/pry_version.rb b/lib/pry/commands/pry_version.rb index 3021b7e4..8cb8fd85 100644 --- a/lib/pry/commands/pry_version.rb +++ b/lib/pry/commands/pry_version.rb @@ -4,6 +4,10 @@ class Pry group 'Misc' description 'Show Pry version.' + banner <<-'BANNER' + Show Pry version. + BANNER + def process output.puts "Pry version: #{Pry::VERSION} on Ruby #{RUBY_VERSION}." end diff --git a/lib/pry/commands/raise_up.rb b/lib/pry/commands/raise_up.rb index ed05dc86..745556c0 100644 --- a/lib/pry/commands/raise_up.rb +++ b/lib/pry/commands/raise_up.rb @@ -7,15 +7,18 @@ class Pry command_options :listing => 'raise-up' banner <<-BANNER - Raise up, like exit, allows you to quit pry. Instead of returning a value however, it raises an exception. - If you don't provide the exception to be raised, it will use the most recent exception (in pry _ex_). + Raise up, like exit, allows you to quit pry. Instead of returning a value + however, it raises an exception. If you don't provide the exception to be + raised, it will use the most recent exception (in pry `_ex_`). - e.g. `raise-up "get-me-out-of-here"` is equivalent to: - `raise "get-me-out-of-here" - raise-up` + When called as raise-up! (with an exclamation mark), this command raises the + exception through any nested prys you have created by "cd"ing into objects. - When called as raise-up! (with an exclamation mark), this command raises the exception through - any nested prys you have created by "cd"ing into objects. + raise-up "get-me-out-of-here" + + # This is equivalent to the command above. + raise "get-me-out-of-here" + raise-up BANNER def process diff --git a/lib/pry/commands/reload_code.rb b/lib/pry/commands/reload_code.rb index 4d00ca9c..1656393c 100644 --- a/lib/pry/commands/reload_code.rb +++ b/lib/pry/commands/reload_code.rb @@ -2,7 +2,11 @@ class Pry class Command::ReloadCode < Pry::ClassCommand match 'reload-code' group 'Misc' - description 'Reload the source file that contains the specified code object' + description 'Reload the source file that contains the specified code object.' + + banner <<-'BANNER' + Reload the source file that contains the specified code object. + BANNER def process code_object = Pry::CodeObject.lookup(obj_name, target, _pry_) diff --git a/lib/pry/commands/reset.rb b/lib/pry/commands/reset.rb index 5a864dd1..4414cbb5 100644 --- a/lib/pry/commands/reset.rb +++ b/lib/pry/commands/reset.rb @@ -4,6 +4,10 @@ class Pry group 'Context' description 'Reset the REPL to a clean state.' + banner <<-'BANNER' + Reset the REPL to a clean state. + BANNER + def process output.puts 'Pry reset.' exec 'pry' diff --git a/lib/pry/commands/ri.rb b/lib/pry/commands/ri.rb index 1a2d64b6..4cdc866f 100644 --- a/lib/pry/commands/ri.rb +++ b/lib/pry/commands/ri.rb @@ -2,13 +2,15 @@ class Pry class Command::Ri < Pry::ClassCommand match 'ri' group 'Introspection' - description 'View ri documentation. e.g `ri Array#each`' + description 'View ri documentation.' - banner <<-BANNER + banner <<-'BANNER' Usage: ri [spec] - e.g. ri Array#each - Relies on the rdoc gem being installed. See also: show-doc. + View ri documentation. Relies on the "rdoc" gem being installed. + See also "show-doc" command. + + ri Array#each BANNER def process(spec) diff --git a/lib/pry/commands/save_file.rb b/lib/pry/commands/save_file.rb index afed4566..25e4c8b5 100644 --- a/lib/pry/commands/save_file.rb +++ b/lib/pry/commands/save_file.rb @@ -6,20 +6,22 @@ class Pry group 'Input and Output' description 'Export to a file using content from the REPL.' - banner <<-USAGE + banner <<-'BANNER' Usage: save-file [OPTIONS] [FILE] - Save REPL content to a file. - e.g: save-file my_method ./hello.rb - e.g: save-file -i 1..10 ./hello.rb --append - e.g: save-file show-method ./my_command.rb - e.g: save-file sample_file.rb --lines 2..10 ./output_file.rb - USAGE + + Export to a file using content from the REPL. + + save-file my_method ./hello.rb + save-file -i 1..10 ./hello.rb --append + save-file show-method ./my_command.rb + save-file sample_file.rb --lines 2..10 ./output_file.rb + BANNER def options(opt) CodeCollector.inject_options(opt) - opt.on :to=, "Select where content is to be saved." - opt.on :a, :append, "Append output to file." + opt.on :to=, "Select where content is to be saved" + opt.on :a, :append, "Append output to file" end def process diff --git a/lib/pry/commands/shell_command.rb b/lib/pry/commands/shell_command.rb index 6de87d0c..3c20123a 100644 --- a/lib/pry/commands/shell_command.rb +++ b/lib/pry/commands/shell_command.rb @@ -6,6 +6,15 @@ class Pry command_options :listing => '.', :use_prefix => false, :takes_block => true + banner <<-'BANNER' + Usage: .COMMAND_NAME + + All text following a "." is forwarded to the shell. + + .ls -aF + .uname + BANNER + def process(cmd) if cmd =~ /^cd\s+(.+)/i dest = $1 diff --git a/lib/pry/commands/shell_mode.rb b/lib/pry/commands/shell_mode.rb index 3e760431..20b8ce05 100644 --- a/lib/pry/commands/shell_mode.rb +++ b/lib/pry/commands/shell_mode.rb @@ -4,6 +4,10 @@ class Pry group 'Input and Output' description 'Toggle shell mode. Bring in pwd prompt and file completion.' + banner <<-'BANNER' + Toggle shell mode. Bring in pwd prompt and file completion. + BANNER + def process case _pry_.prompt when Pry::SHELL_PROMPT diff --git a/lib/pry/commands/show_command.rb b/lib/pry/commands/show_command.rb index a43406c9..fc0e844f 100644 --- a/lib/pry/commands/show_command.rb +++ b/lib/pry/commands/show_command.rb @@ -4,15 +4,19 @@ class Pry group 'Introspection' description 'Show the source for CMD.' + banner <<-'BANNER' + Show the source for CMD. + BANNER + def process(*args) target = target() opts = Slop.parse!(args) do |opt| - opt.banner unindent <<-USAGE - NOTE: show-command is DEPRECATED. Use show-source [command_name] instead. - USAGE + opt.banner unindent <<-'BANNER' + NOTE: show-command is DEPRECATED. Use show-source [command_name] instead. + BANNER - opt.on :h, :help, "This message." do + opt.on :h, :help, "This message" do output.puts opt.help end end diff --git a/lib/pry/commands/show_doc.rb b/lib/pry/commands/show_doc.rb index b66c572f..9d55ffd7 100644 --- a/lib/pry/commands/show_doc.rb +++ b/lib/pry/commands/show_doc.rb @@ -6,16 +6,18 @@ class Pry match 'show-doc' group 'Introspection' - description 'Show the documentation for a method or class. Aliases: \?' + description 'Show the documentation for a method or class.' banner <<-BANNER - Usage: show-doc [OPTIONS] [METH] + Usage: show-doc [OPTIONS] [METH] Aliases: ? - Show the documentation for a method or class. Tries instance methods first and then methods by default. - e.g show-doc hello_method # docs for hello_method - e.g show-doc Pry # docs for Pry class - e.g show-doc Pry -a # docs for all definitions of Pry class (all monkey patches) + Show the documentation for a method or class. Tries instance methods first and + then methods by default. + + show-doc hi_method # docs for hi_method + show-doc Pry # for Pry class + show-doc Pry -a # for all definitions of Pry class (all monkey patches) BANNER # The docs for code_object prepared for display. diff --git a/lib/pry/commands/show_info.rb b/lib/pry/commands/show_info.rb index bfe6dc32..8aca2747 100644 --- a/lib/pry/commands/show_info.rb +++ b/lib/pry/commands/show_info.rb @@ -2,19 +2,19 @@ class Pry class Command::ShowInfo < Pry::ClassCommand extend Pry::Helpers::BaseHelpers - options :shellwords => false - options :requires_gem => "ruby18_source_location" if mri_18? + command_options :shellwords => false + command_options :requires_gem => "ruby18_source_location" if mri_18? def setup require 'ruby18_source_location' if mri_18? end def options(opt) - opt.on :s, :super, "Select the 'super' method. Can be repeated to traverse the ancestors.", :as => :count - opt.on :l, "line-numbers", "Show line numbers." - 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." - opt.on :a, :all, "Show all definitions and monkeypatches of the module/class" + opt.on :s, :super, "Select the 'super' method. Can be repeated to traverse the ancestors", :as => :count + opt.on :l, "line-numbers", "Show line numbers" + 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" + opt.on :a, :all, "Show all definitions and monkeypatches of the module/class" end def process diff --git a/lib/pry/commands/show_input.rb b/lib/pry/commands/show_input.rb index 4f8dbf1d..8b727877 100644 --- a/lib/pry/commands/show_input.rb +++ b/lib/pry/commands/show_input.rb @@ -4,6 +4,10 @@ class Pry group 'Editing' description 'Show the contents of the input buffer for the current multi-line expression.' + banner <<-'BANNER' + Show the contents of the input buffer for the current multi-line expression. + BANNER + def process output.puts Code.new(eval_string).with_line_numbers end diff --git a/lib/pry/commands/show_source.rb b/lib/pry/commands/show_source.rb index cc10ab24..73356d2e 100644 --- a/lib/pry/commands/show_source.rb +++ b/lib/pry/commands/show_source.rb @@ -4,20 +4,21 @@ class Pry class Command::ShowSource < Command::ShowInfo match 'show-source' group 'Introspection' - description 'Show the source for a method or class. Aliases: $, show-method' + description 'Show the source for a method or class.' - banner <<-BANNER - Usage: show-source [OPTIONS] [METH|CLASS] + banner <<-'BANNER' + Usage: show-source [OPTIONS] [METH|CLASS] Aliases: $, show-method - Show the source for a method or class. Tries instance methods first and then methods by default. + Show the source for a method or class. Tries instance methods first and then + methods by default. - e.g: `show-source hello_method` - e.g: `show-source hello_method` - e.g: `show-source Pry#rep` # source for Pry#rep method - e.g: `show-source Pry` # source for Pry class - e.g: `show-source Pry -a` # source for all Pry class definitions (all monkey patches) - e.g: `show-source Pry --super # source for superclass of Pry (Object class) + show-source hi_method + show-source hi_method + show-source Pry#rep # source for Pry#rep method + show-source Pry # for Pry class + show-source Pry -a # for all Pry class definitions (all monkey patches) + show-source Pry --super # for superclass of Pry (Object class) https://github.com/pry/pry/wiki/Source-browsing#wiki-Show_method BANNER diff --git a/lib/pry/commands/simple_prompt.rb b/lib/pry/commands/simple_prompt.rb index 42911afe..8a1fa12a 100644 --- a/lib/pry/commands/simple_prompt.rb +++ b/lib/pry/commands/simple_prompt.rb @@ -4,6 +4,10 @@ class Pry group 'Misc' description 'Toggle the simple prompt.' + banner <<-'BANNER' + Toggle the simple prompt. + BANNER + def process case _pry_.prompt when Pry::SIMPLE_PROMPT diff --git a/lib/pry/commands/stat.rb b/lib/pry/commands/stat.rb index 4c1005d8..06a191b5 100644 --- a/lib/pry/commands/stat.rb +++ b/lib/pry/commands/stat.rb @@ -5,10 +5,12 @@ class Pry description 'View method information and set _file_ and _dir_ locals.' command_options :shellwords => false - banner <<-BANNER + banner <<-'BANNER' Usage: stat [OPTIONS] [METH] + Show method information for method METH and set _file_ and _dir_ locals. - e.g: stat hello_method + + stat hello_method BANNER def options(opt) diff --git a/lib/pry/commands/switch_to.rb b/lib/pry/commands/switch_to.rb index a1fc481e..ad3e71c1 100644 --- a/lib/pry/commands/switch_to.rb +++ b/lib/pry/commands/switch_to.rb @@ -2,8 +2,11 @@ class Pry class Command::SwitchTo < Pry::ClassCommand match 'switch-to' group 'Navigating Pry' - description 'Start a new subsession on a binding in the current stack ' \ - '(numbered by nesting).' + description 'Start a new subsession on a binding in the current stack.' + + banner <<-'BANNER' + Start a new subsession on a binding in the current stack (numbered by nesting). + BANNER def process(selection) selection = selection.to_i diff --git a/lib/pry/commands/toggle_color.rb b/lib/pry/commands/toggle_color.rb index 85bbe8e5..74295aab 100644 --- a/lib/pry/commands/toggle_color.rb +++ b/lib/pry/commands/toggle_color.rb @@ -4,6 +4,12 @@ class Pry group 'Misc' description 'Toggle syntax highlighting.' + banner <<-'BANNER' + Usage: toggle-color + + Toggle syntax highlighting. + BANNER + def process Pry.color = !Pry.color output.puts "Syntax highlighting #{Pry.color ? "on" : "off"}" diff --git a/lib/pry/commands/whereami.rb b/lib/pry/commands/whereami.rb index c1cd5428..21304db1 100644 --- a/lib/pry/commands/whereami.rb +++ b/lib/pry/commands/whereami.rb @@ -4,25 +4,24 @@ class Pry description 'Show code surrounding the current context.' group 'Context' - banner <<-BANNER + banner <<-'BANNER' Usage: whereami [-qn] [N] - Describe the current location. If you use `binding.pry` inside a - method then whereami will print out the source for that method. + Describe the current location. If you use `binding.pry` inside a method then + whereami will print out the source for that method. - If a number is passed, then N lines before and after the current line - will be shown instead of the method itself. + If a number is passed, then N lines before and after the current line will be + shown instead of the method itself. - The `-q` flag can be used to suppress error messages in the case that - there's no code to show. This is used by pry in the default - before_session hook to show you when you arrive at a `binding.pry`. + The `-q` flag can be used to suppress error messages in the case that there's + no code to show. This is used by pry in the default before_session hook to show + you when you arrive at a `binding.pry`. The `-n` flag can be used to hide line numbers so that code can be copy/pasted effectively. - When pry was started on an Object and there is no associated method, - whereami will instead output a brief description of the current - object. + When pry was started on an Object and there is no associated method, whereami + will instead output a brief description of the current object. BANNER def setup @@ -32,8 +31,8 @@ class Pry end def options(opt) - opt.on :q, :quiet, "Don't display anything in case of an error" - opt.on :n, :"no-line-numbers", "Do not display line numbers." + opt.on :q, :quiet, "Don't display anything in case of an error" + opt.on :n, :"no-line-numbers", "Do not display line numbers" end def code diff --git a/lib/pry/commands/wtf.rb b/lib/pry/commands/wtf.rb index c32bd332..37d1da74 100644 --- a/lib/pry/commands/wtf.rb +++ b/lib/pry/commands/wtf.rb @@ -2,27 +2,25 @@ class Pry class Command::Wtf < Pry::ClassCommand match /wtf([?!]*)/ group 'Context' - description 'Show the backtrace of the most recent exception' + description 'Show the backtrace of the most recent exception.' options :listing => 'wtf?' - banner <<-BANNER + banner <<-'BANNER' + Usage: wtf[?|!] + Show's a few lines of the backtrace of the most recent exception (also available - as _ex_.backtrace). + as `_ex_.backtrace`). If you want to see more lines, add more question marks or + exclamation marks. - If you want to see more lines, add more question marks or exclamation marks: + wtf? + wtf?!???!?!? - e.g. - pry(main)> wtf? - pry(main)> wtf?!???!?!? - - To see the entire backtrace, pass the -v/--verbose flag: - - e.g. - pry(main)> wtf -v + # To see the entire backtrace, pass the `-v` or `--verbose` flag. + wtf -v BANNER def options(opt) - opt.on(:v, :verbose, "Show the full backtrace.") + opt.on :v, :verbose, "Show the full backtrace" end def process diff --git a/spec/commands/show_source_spec.rb b/spec/commands/show_source_spec.rb index 6608e249..ec1199fd 100644 --- a/spec/commands/show_source_spec.rb +++ b/spec/commands/show_source_spec.rb @@ -21,7 +21,7 @@ if !PryTestHelpers.mri18_and_no_real_source_location? end it "should output help" do - pry_eval('show-source -h').should =~ /Usage: show-source/ + pry_eval('show-source -h').should =~ /Usage:\s+show-source/ end it "should output a method's source with line numbers" do