Merge: Nitpretty: make the tool more customizable
authorJean Privat <jean@pryen.org>
Wed, 14 Jan 2015 01:16:48 +0000 (20:16 -0500)
committerJean Privat <jean@pryen.org>
Wed, 14 Jan 2015 01:16:48 +0000 (20:16 -0500)
Added some options to control behavior.

Interesting features:

* option --break-strings to enable literal string breaks
* option --inline-do to enable do inlining
* option --skip-empty to enable empty line skipping

Pull-Request: #1088
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

1  2 
src/nitpretty.nit

@@@ -81,9 -97,18 +97,19 @@@ var dir = toolcontext.opt_dir.value or 
  if not dir.file_exists then dir.mkdir
  var v = new PrettyPrinterVisitor
  
+ if toolcontext.opt_break_str.value then
+       v.break_strings = true
+ end
+ if toolcontext.opt_inline_do.value then
+       v.inline_do = true
+ end
+ if toolcontext.opt_skip_empty.value then
+       v.skip_empty = true
+ end
  for mmodule in mmodules do
 -      if not mbuilder.mmodule2nmodule.has_key(mmodule) then
 +      var nmodule = mbuilder.mmodule2node(mmodule)
 +      if nmodule == null then
                print " Error: no source file for module {mmodule}"
                return
        end