Module: HamdownCore::Cli
- Defined in:
- lib/hamdown_core/cli.rb
Class Method Summary collapse
Class Method Details
.call(argv) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# 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 |