Class: AlbaHabla::Cli
- Inherits:
-
Object
- Object
- AlbaHabla::Cli
- Defined in:
- lib/alba_habla/cli.rb
Overview
Class used to parse command line arguments
Constant Summary collapse
- DEFAULT_OPTIONS =
{ book_path: '', }.freeze
Class Method Summary collapse
Class Method Details
.parse(args) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/alba_habla/cli.rb', line 10 def self.parse(args) = DEFAULT_OPTIONS.dup opt_parser = OptionParser.new do |opts| opts. = 'Usage: alba_habla [options]' opts.on('-bBOOK_PATH', '--books=BOOK_PATH', 'Path to folder with book files') do |bp| [:book_path] = bp.end_with?('/') ? bp : "#{bp}/" end end opt_parser.parse!(args) end |