Class: Madman::Commands::Render

Inherits:
MisterBin::Command
  • Object
show all
Includes:
Colsole
Defined in:
lib/madman/commands/render.rb

Instance Method Summary collapse

Instance Method Details

#runObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/madman/commands/render.rb', line 23

def run
  infile = args['FILE']
  outfile = args['--save']
  renderer = args['--github'] ? :github : :default

  doc = Madman::Document.from_file infile
  
  output = doc.render renderer

  if outfile
    File.write outfile, output    
    say "Saved !txtgrn!#{outfile}"
  else
    puts output
  end
end