added fix-indent command

Re-indents the eval_string, useful for amend_line and play, etc
This commit is contained in:
John Mair 2013-01-12 22:14:35 +01:00
parent 8732bb1025
commit 54baa7a463
1 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,19 @@
class Pry
class Command::FixIndent < Pry::ClassCommand
match 'fix-indent'
group 'Input and Output'
description "Correct the indentation for contents of the input buffer"
banner <<-USAGE
Usage: fix-indent
USAGE
def process
indented_str = Pry::Indent.indent(eval_string)
eval_string.replace indented_str
end
end
Pry::Commands.add_command(Pry::Command::FixIndent)
end