Sha256: 7596fde6504cf91486725248136b72b069f079603d0b09ad0f94cc1767bde109
Contents?: true
Size: 1011 Bytes
Versions: 2
Compression:
Stored size: 1011 Bytes
Contents
class Pry class Command::ShellCommand < Pry::ClassCommand match(/\.(.*)/) group 'Input and Output' description "All text following a '.' is forwarded to the shell." command_options :listing => '.<shell command>', :use_prefix => false, :takes_block => true banner <<-'BANNER' Usage: .COMMAND_NAME All text following a "." is forwarded to the shell. .ls -aF .uname BANNER def process(cmd) if cmd =~ /^cd\s+(.+)/i dest = $1 begin Dir.chdir File.expand_path(dest) rescue Errno::ENOENT raise CommandError, "No such directory: #{dest}" end else pass_block(cmd) if command_block command_block.call `#{cmd}` else Pry.config.system.call(output, cmd, _pry_) end end end def complete(search) super + Bond::Rc.files(search.split(" ").last || '') end end Pry::Commands.add_command(Pry::Command::ShellCommand) end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pry-1.0.0.pre1-i386-mswin32 | lib/pry/commands/shell_command.rb |
pry-1.0.0.pre1-i386-mingw32 | lib/pry/commands/shell_command.rb |