bin/md-ruby-eval in md-ruby-eval-0.3.0 vs bin/md-ruby-eval in md-ruby-eval-0.4.0
- old
+ new
@@ -5,10 +5,11 @@
# this will only run if the script was the main, not load'd or require'd
to_require = []
indentation = 40
line_length = 79
auto = false
+verbose = false
dir = Dir.pwd
OptionParser.new do |opts|
opts.banner = File.read(__dir__ + '/../README.md') + "\n## Options:\n\n"
@@ -34,10 +35,15 @@
opts.on('--[no-]auto',
'Automatic mode. Finds `*.in.md` files outputting `*.out.md` files') do |v|
auto = true
end
+
+ opts.on('--[no-]verbose',
+ 'Print code chunks right before their execution') do |v|
+ verbose = true
+ end
end.parse!
Dir.chdir dir do
if auto
input_paths = Dir.glob('*.in.md')
@@ -48,17 +54,17 @@
init_path = File.basename(input_path, '.in.md') + '.init.rb'
if File.exist? init_path
puts "using: #{init_path}"
load init_path
end
- MDRubyEval.new input_path, input_path.gsub(/(\.in)?\.md$/, '.out.md'), binding, indentation, line_length
+ MDRubyEval.new input_path, input_path.gsub(/(\.in)?\.md$/, '.out.md'), binding, indentation, line_length, verbose
end
Process.wait pid
end
else
input_path, output_path = ARGV.map { |p| File.expand_path p }
raise 'no input path' unless input_path && File.exist?(input_path)
- MDRubyEval.new input_path, output_path, binding, indentation, line_length
+ MDRubyEval.new input_path, output_path, binding, indentation, line_length, verbose
end
end