Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 34 lines (27 sloc) 0.943 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
class Pry
  module DefaultCommands
    Cd = Pry::CommandSet.new do
      create_command "cd" do
        group "Context"
        description "Move into a new context (object or scope)."

        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.

e.g: `cd @x`
e.g: `cd ..`
e.g: `cd /`
e.g: `cd -`

https://github.com/pry/pry/wiki/State-navigation#wiki-Changing_scope
BANNER

        def process
          stack, old_stack = context_from_object_path(arg_string, _pry_, state.old_stack||[])
          state.old_stack = old_stack
          _pry_.binding_stack = stack unless stack.nil?
        end

      end
    end
  end

end
Something went wrong with that request. Please try again.