Sha256: aceb8622838e697afaef7c1920e2f8a6a164ff89c0160c0d99c894eb6edae137

Contents?: true

Size: 1.07 KB

Versions: 174

Compression:

Stored size: 1.07 KB

Contents

class Pry
  class Command::Cd < Pry::ClassCommand
    match 'cd'
    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.

      cd @x
      cd ..
      cd /
      cd -

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

    def process
      state.old_stack ||= []

      if arg_string.strip == "-"
        unless state.old_stack.empty?
          _pry_.binding_stack, state.old_stack = state.old_stack, _pry_.binding_stack
        end
      else
        stack = ObjectPath.new(arg_string, _pry_.binding_stack).resolve

        if stack && stack != _pry_.binding_stack
          state.old_stack = _pry_.binding_stack
          _pry_.binding_stack = stack
        end
      end
    end
  end

  Pry::Commands.add_command(Pry::Command::Cd)
end

Version data entries

174 entries across 167 versions & 40 rubygems

Version Path
chess_engine-0.0.1 vendor/bundle/gems/pry-0.12.2/lib/pry/commands/cd.rb
xaiml-0.1.3 vendor/bundle/ruby/2.5.0/gems/pry-0.11.3/lib/pry/commands/cd.rb
alimentos-alu0100945645-0.1.0 vendor/bundle/ruby/2.3.0/gems/pry-0.12.2/lib/pry/commands/cd.rb
alimentos-alu0100945645-1.0.0 vendor/bundle/ruby/2.3.0/gems/pry-0.12.2/lib/pry/commands/cd.rb
xaiml-0.1.2 vendor/bundle/ruby/2.5.0/gems/pry-0.11.3/lib/pry/commands/cd.rb
pry-0.12.2-java lib/pry/commands/cd.rb
pry-0.12.2 lib/pry/commands/cd.rb
pry-0.12.1 lib/pry/commands/cd.rb
pry-0.12.1-java lib/pry/commands/cd.rb
pry-0.12.0 lib/pry/commands/cd.rb
pry-0.12.0-java lib/pry/commands/cd.rb
xaiml-0.1.1 vendor/bundle/ruby/2.5.0/gems/pry-0.11.3/lib/pry/commands/cd.rb
xaiml-0.1.0 vendor/bundle/ruby/2.5.0/gems/pry-0.11.3/lib/pry/commands/cd.rb
logstash-filter-device_detection-1.0.7-java vendor/bundle/jruby/1.9/gems/pry-0.10.4-java/lib/pry/commands/cd.rb
mrcooper-logstash-output-azuresearch-0.2.2 vendor/jruby/2.5.0/gems/pry-0.10.4-java/lib/pry/commands/cd.rb
monero_wallet_gen-0.1.0 vendor/bundle/ruby/2.3.0/gems/pry-0.11.3/lib/pry/commands/cd.rb
sb_prime_table-0.1.1 vendor/bundle/ruby/2.4.0/gems/pry-0.11.3/lib/pry/commands/cd.rb
sb_prime_table-0.1.0 vendor/bundle/ruby/2.4.0/gems/pry-0.11.3/lib/pry/commands/cd.rb
comiditaULL-0.1.1 vendor/bundle/ruby/2.3.0/gems/pry-0.11.2/lib/pry/commands/cd.rb
comidita_ull-0.1.1 vendor/bundle/ruby/2.3.0/gems/pry-0.11.2/lib/pry/commands/cd.rb