Class: Highlights::CLI
- Inherits:
-
Object
- Object
- Highlights::CLI
- Defined in:
- lib/highlights/cli.rb
Defined Under Namespace
Classes: Options
Instance Method Summary collapse
- #get_options ⇒ Object
-
#initialize(args) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize(args) ⇒ CLI
Returns a new instance of CLI.
5 6 7 8 |
# File 'lib/highlights/cli.rb', line 5 def initialize(args) args << '-h' if ARGV.empty? @args = args end |
Instance Method Details
#get_options ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/highlights/cli.rb', line 16 def = Options.new(nil, "notes.md") OptionParser.new do |opts| opts. = "Usage: highlights -f file.csv -o [output file]" opts.on("-fFILENAME", "--file=FILENAME", "Kindle notes CSV file") do |f| .filename = f end opts.on("-oOUTPUT", "--output=OUTPUT", "Output file. Accepts HTML and markdown (default: notes.md)") do |o| .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) end |