class Highlights::CLI
Constants
- Options
Public Class Methods
new(args)
click to toggle source
# File lib/highlights/cli.rb, line 5 def initialize(args) args << '-h' if ARGV.empty? @args = args end
Public Instance Methods
get_options()
click to toggle source
# File lib/highlights/cli.rb, line 16 def get_options options = Options.new(nil, "notes.md") OptionParser.new do |opts| opts.banner = "Usage: highlights -f file.csv -o [output file]" opts.on("-fFILENAME", "--file=FILENAME", "Kindle notes CSV file") do |f| options.filename = f end opts.on("-oOUTPUT", "--output=OUTPUT", "Output file. Accepts HTML and markdown (default: notes.md)") do |o| options.output = o end opts.on("-h", "--help", "Show help") do puts opts exit end opts.on("-v", "--version", "Show version") do puts VERSION exit end end.parse!(@args) options end
run()
click to toggle source
# File lib/highlights/cli.rb, line 10 def run options = get_options document = Parser.new(options.filename).parse Renderer.render(document, options.output) end