Class: JunitModel::CLI::Parser
- Inherits:
-
Object
- Object
- JunitModel::CLI::Parser
- Defined in:
- lib/junit_model/cli/cli_parser.rb
Overview
Parse CLI::Options from ARGV
Class Method Summary collapse
Class Method Details
.parse(argv) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/junit_model/cli/cli_parser.rb', line 16 def self.parse(argv) = Options.new opt_parser = OptionParser.new do |opts| opts. = 'Usage: example.rb [options]' opts.on('-o', '--output OUTPUT', String, 'Output') do |n| .output_path = n end opts.on('-h', '--help', 'Prints this help') do puts opts exit end end opt_parser.order(argv) do |file| .files << file unless file.nil? end opt_parser.parse(argv) end |