2012-08-11 20:22:29 -04:00
|
|
|
class Pry
|
2012-12-25 16:35:17 -05:00
|
|
|
class Command::ShellMode < Pry::ClassCommand
|
|
|
|
match 'shell-mode'
|
2012-08-11 21:26:59 -04:00
|
|
|
group 'Input and Output'
|
2012-12-25 16:35:17 -05:00
|
|
|
description 'Toggle shell mode. Bring in pwd prompt and file completion.'
|
2012-08-11 21:26:59 -04:00
|
|
|
|
2013-01-09 15:23:19 -05:00
|
|
|
banner <<-'BANNER'
|
|
|
|
Toggle shell mode. Bring in pwd prompt and file completion.
|
|
|
|
BANNER
|
|
|
|
|
2012-08-11 21:26:59 -04:00
|
|
|
def process
|
|
|
|
case _pry_.prompt
|
|
|
|
when Pry::SHELL_PROMPT
|
|
|
|
_pry_.pop_prompt
|
2014-01-20 03:08:38 -05:00
|
|
|
_pry_.custom_completions = _pry_.config.file_completer
|
2012-08-11 21:26:59 -04:00
|
|
|
else
|
|
|
|
_pry_.push_prompt Pry::SHELL_PROMPT
|
2014-01-20 03:08:38 -05:00
|
|
|
_pry_.custom_completions = _pry_.config.command_completer
|
2012-08-11 21:26:59 -04:00
|
|
|
end
|
2012-08-11 20:22:29 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-12-25 16:35:17 -05:00
|
|
|
Pry::Commands.add_command(Pry::Command::ShellMode)
|
|
|
|
Pry::Commands.alias_command 'file-mode', 'shell-mode'
|
2012-08-11 20:22:29 -04:00
|
|
|
end
|