class Yome::Cli
Public Class Methods
exec(argv = [])
click to toggle source
# File lib/yome/cli.rb, line 10 def self.exec(argv = []) opt = {lang: ""} parser = OptionParser.new("Usage: yome [DIR] [options]") parser.on('-o FILE', 'Output file name') {|v| opt[:output] = v } parser.on('--lang LANG', 'Specify code blocks language') {|v| opt[:lang] = v } parser.parse!(argv) dir = argv[0] || "." main(dir, opt) end
main(dir, opt)
click to toggle source
# File lib/yome/cli.rb, line 22 def self.main(dir, opt) parser = Parser.new(dir) writer = Writer.new(parser, opt[:lang]) if opt[:output] File.write(opt[:output], writer.result) else puts writer.result end end