module Hamdown::Cli

CLI module it takes args with file path and return text to STDOUT

Public Class Methods

perform(args) click to toggle source
   # File lib/hamdown/cli.rb
 5 def self.perform(args)
 6   file_path = args[0]
 7   if file_path.nil? || file_path.size == 0
 8     puts 'Error: No file.'
 9     puts 'Use it like: "bin/hamdown path_to/file.hd > output.html"'
10     return nil
11   end
12 
13   content = File.open(file_path, 'r').read
14   output = Engine.perform(content)
15   puts output
16 end