Pry: handy commands

If you’re stuck in an infinite loop:

  !!!                Alias for exit-program

More from pry help

Help

  help               Show a list of commands or information about a specific command

Context

  cd                 Move into a new context (object or scope).

  find-method        Recursively search for a method within a Class/Module or the current namespace.

  ls                 Show the list of vars and methods in the current scope.

  pry-backtrace      Show the backtrace for the Pry session.

  raise-up           Raise an exception out of the current pry instance.

  reset              Reset the REPL to a clean state.

  whereami           Show code surrounding the current context.

  wtf?               Show the backtrace of the most recent exception.

Editing

  !                  Clear the input buffer.

  amend-line         Amend a line of input in multi-line mode.

  edit               Invoke the default editor on a file.

  hist               Show and replay Readline history.

  play               Playback a string variable or a method or a file as input.

  show-input         Show the contents of the input buffer for the current multi-line expression.

Introspection

  ri                 View ri documentation.

  show-doc           Show the documentation for a method or class.

  show-source        Show the source for a method or class.

  stat               View method information and set _file_ and _dir_ locals.

Gems

  gem-cd             Change working directory to specified gem’s directory.

  gem-install        Install a gem and refresh the gem cache.

  gem-list           List and search installed gems.

  gem-open           Opens the working directory of the gem in your editor

Commands

  import-set         Import a Pry command set.

  install-command    Install a disabled command.

Aliases

  !!!                Alias for exit-program

  !!@                Alias for exit-all

  $                  Alias for show-source

  ?                  Alias for show-doc

  breakpoint         Alias for break

  breaks             Alias for breakpoints

  c                  Alias for continue

  clipit             Alias for gist --clip

  file-mode          Alias for shell-mode

  history            Alias for hist

  jist               Alias for gist

  n                  Alias for next

  quit               Alias for exit

  quit-program       Alias for exit-program

  reload-method      Alias for reload-code

  s                  Alias for step

  show-method        Alias for show-source

Leave a Reply

Your email address will not be published. Required fields are marked *