Sha256: 029537195dbfddd2bfef557752a34aa80e85439440d2a6745e4092640ced64cc

Contents?: true

Size: 1.42 KB

Versions: 3

Compression:

Stored size: 1.42 KB

Contents

module Gry
  class Option
    attr_reader :args, :process, :version, :fast, :max_count, :min_difference, :display_disabled_cops, :metrics_percentile, :cache, :raw

    def initialize(argv)
      opt = OptionParser.new
      @version = false
      @process = Parallel.processor_count
      @fast = true
      @max_count = 10
      @min_difference = 10
      @display_disabled_cops = false
      @metrics_percentile = 95
      @cache = true
      @raw = false

      opt.banner = 'Usage: gry [options] [Cop1, Cop2, ...]'

      opt.on('-d', '--debug', 'Output debug log.') {Gry.debug_mode!}
      opt.on('-p', '--process=VAL', 'Number of parallel processes.') {|v| @process = v.to_i}
      opt.on('-v', '--version', 'Display version.') {@version = true}
      opt.on('--[no-]fast', 'Run only fast cops. Default: true') {|v| @fast = v}
      opt.on('--max-count=10', 'Upper limit of issues.') {|v| @max_count = v.to_i}
      opt.on('--min-difference=10', 'Lower limit of issues number difference') {|v| @min_difference = v.to_i}
      opt.on('--metrics-percentile=95', 'Percentile for allowed complex code') {|v| @metrics_percentile = v.to_i}
      opt.on('--display-disabled-cops', 'Display disabled cops') {|v| @display_disabled_cops = v}
      opt.on('--[no-]cache', 'Run gry with cache. Default: true') {|v| @cache = v}
      opt.on('--raw', 'Display raw data(JSON). Default: false') {|v| @raw = v}

      @args = opt.parse(argv)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gry-0.7.0 lib/gry/option.rb
gry-0.6.1 lib/gry/option.rb
gry-0.6.0 lib/gry/option.rb