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
-
.parse(args) ⇒ Object
rubocop:disable Metrics/MethodLength.
Class Method Details
.parse(args) ⇒ Object
rubocop:disable Metrics/MethodLength
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/alba_habla/cli.rb', line 11 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 opts.on('-vVOICE', '--voice=VOICE', 'Voice to be used by your speech synthesizer') do |v| [:voice] = v end end opt_parser.parse!(args) end |