module HamdownCore::Cli

Public Class Methods

call(argv) click to toggle source
# File lib/hamdown_core/cli.rb, line 7
def self.call(argv)
  file_name = OptionParser.new.tap do |parser|
    parser.version = VERSION
  end.parse!(argv).first

  if file_name.nil? || file_name.size == 0
    puts 'Error: No file.'
    puts 'Use it like: "exe/hamdown_core path_to/file.hd > output.html"'
    return nil
  end

  content = File.open(file_name, 'r').read
  output = Engine.call(content)
  puts output
end