1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00
pry--pry/lib/pry/commands/cd.rb
Kyrylo Silin 256f35422a Prettify command descriptions, switches and stuff
Wrap command descriptions to 80 characters. Convert some string options
to symbols (where possible). Align options in code. Remove dots in the
end of switch descriptions.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
2013-01-09 22:23:19 +02:00

30 lines
817 B
Ruby

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 ||= []
stack, state.old_stack = context_from_object_path(arg_string, _pry_, state.old_stack)
_pry_.binding_stack = stack if stack
end
end
Pry::Commands.add_command(Pry::Command::Cd)
end