Sha256: 213766f23086d5fba24001bbff4bcf54089501db0e4fed05345c2c32c378b81f
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
# frozen_string_literal: true module Slimembedcop # Command line options. class Option attr_reader :version, :autocorrect, :forced_config_path, :color, :debug, :args, :default_config_path, :default_path_patterns def initialize(argv) opt = OptionParser.new @version = false @autocorrect = false @forced_config_path = nil @color = nil @debug = false @default_config_path = File.expand_path('../default.yml', __dir__) @default_path_patterns = %w[**/*.slim].freeze opt.banner = 'Usage: slimembedcop [options] [file1, file2, ...]' opt.on('-v', '--version', 'Display version.') { @version = true } opt.on('-a', '--autocorrect', 'Autocorrect offenses.') { @autocorrect = true } opt.on('-c', '--config=', 'Specify configuration file.') { |path| @forced_config_path = path } opt.on('--[no-]color', 'Force color output on or off.') { |value| @color = value } opt.on('-d', '--debug', 'Display debug info.') { |value| @debug = value } @args = opt.parse(argv) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
slimembedcop-1.0.0 | lib/slimembedcop/option.rb |
slimembedcop-0.2.0 | lib/slimembedcop/option.rb |