class Opmac2html::CLI

Command line option parser and runner

Public Class Methods

new() click to toggle source
# File lib/opmac2html/cli.rb, line 8
def initialize
  opts = Slop.parse(help: true) do |o|
    o.banner = 'Usage: opmac2html -i <input.tex> -o <output.html>'
    o.string '-i', '--input', 'Input OPmac file'
    o.string '-o', '--output', 'Output HTML file'
    o.on '-h', '--help', 'Shows this message'
    o.on '-v', '--version', 'Shows application version'
  end
  run opts
end

Public Instance Methods

run(opts) click to toggle source
# File lib/opmac2html/cli.rb, line 19
def run(opts)
  puts "opmac2html, version: #{Opmac2html.version}" if opts[:version]
  if opts[:input] && opts[:output]
    Converter.new(opts[:input], opts[:output]).convert
  else
    puts opts
  end
end