From 5eeb0a7541ccf9b9bda2242504978c22b9b33063 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Tue, 14 Jun 2011 14:47:29 +0200 Subject: [PATCH] feature #661: Add unindent functionality --- src/cli/command_parser.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/cli/command_parser.rb b/src/cli/command_parser.rb index b44bd401e2..288f8ed459 100755 --- a/src/cli/command_parser.rb +++ b/src/cli/command_parser.rb @@ -17,6 +17,17 @@ require 'optparse' require 'pp' +class String + def unindent(spaces=nil) + unless spaces + m = self.match(/^(\s*)/) + spaces = m[1].size + end + + self.gsub!(/^ {#{spaces}}/, '') + end +end + module CommandParser OPTIONS = [ VERBOSE={