mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Refine pretty-print indenting
This commit is contained in:
@@ -214,7 +214,7 @@ module MRuby
|
||||
@command ||= @build.mrbcfile
|
||||
IO.popen("#{filename @command} #{@compile_options % {:funcname => funcname}}", 'r+') do |io|
|
||||
[infiles].flatten.each do |f|
|
||||
_pp " MRBC", "#{f}"
|
||||
_pp "MRBC", "#{f}", nil, :indent => 2
|
||||
io.write IO.read(f)
|
||||
end
|
||||
io.close_write
|
||||
|
||||
+6
-2
@@ -57,6 +57,10 @@ else
|
||||
$pp_show = false if $verbose
|
||||
end
|
||||
|
||||
def _pp(cmd, src, tgt=nil)
|
||||
puts '%-5s %s %s' % [cmd, src, tgt ? "-> #{tgt}" : nil] if $pp_show
|
||||
def _pp(cmd, src, tgt=nil, options={})
|
||||
return unless $pp_show
|
||||
|
||||
width = 5
|
||||
template = options[:indent] ? "%#{width*options[:indent]}s %s %s" : "%-#{width}s %s %s"
|
||||
puts template % [cmd, src, tgt ? "-> #{tgt}" : nil]
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user