Class: Opmac2html::CLI
- Inherits:
-
Object
- Object
- Opmac2html::CLI
- Defined in:
- lib/opmac2html/cli.rb
Overview
Command line option parser and runner
Instance Method Summary collapse
-
#initialize ⇒ CLI
constructor
A new instance of CLI.
- #run(opts) ⇒ Object
Constructor Details
#initialize ⇒ CLI
Returns a new instance of CLI.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/opmac2html/cli.rb', line 8 def initialize opts = Slop.parse(help: true) do |o| o. = '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 |
Instance Method Details
#run(opts) ⇒ Object
19 20 21 22 23 24 25 26 |
# 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 |