#!/usr/bin/env ruby

$LOAD_PATH.unshift File.dirname(File.realpath(__FILE__)) + "/../lib"
require 'github/markup'

if ARGV.size < 1
  print "usage: #{File.basename($0)} FILE [ FILES ... ]\n"
  exit 1
end

sources = []

ARGV.each { |s|
  begin
    file = File.open( s, "r" )
    sources.push [ s, file ]
  rescue Exception => e
    $stderr.print "error: #{e.message}\n"
    exit 1
  ensure
  end
}

sources.each { |name, file|
  print GitHub::Markup.render( name, file.read )
  file.close
}

