Class: TestFileFinder::OptionParser

Inherits:
Object
  • Object
show all
Defined in:
lib/test_file_finder/option_parser.rb

Class Method Summary collapse

Class Method Details

.parse!(argv) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/test_file_finder/option_parser.rb', line 9

def self.parse!(argv)
  Options.new.tap do |options|
    ::OptionParser.new do |opts|
      opts.banner = "Usage: tff [options] [...file_paths]"

      opts.on('-f', '--mapping-file FILE', String, 'Use a custom test mapping file') do |mapping_file|
        options.mapping_file = mapping_file
      end

      opts.on('--yaml FILE', String, 'Use a YAML test mapping file') do |mapping_file|
        options.mapping_file = mapping_file
      end

      opts.on('--json FILE', String, 'Use a JSON mapping file') do |json|
        options.json = json
      end

      opts.on('--project-path PROJECT_PATH', String,
        'Path of GitLab project, e.g `gitlab-org/gitlab`') do |project_path|
        options.project_path = project_path
      end

      opts.on('--merge-request-iid MERGE_REQUEST_IID', Integer, 'Merge request internal id') do |merge_request_iid|
        options.merge_request_iid = merge_request_iid
      end
    end.parse!(argv)
  end
end