63 lines
2.2 KiB
Ruby
63 lines
2.2 KiB
Ruby
require 'optparse'
|
|
require 'ostruct'
|
|
|
|
require_relative 'array_extension.rb'
|
|
|
|
class SettingOption
|
|
def initialize
|
|
@options = OpenStruct.new
|
|
OptionParser.new do |opt|
|
|
opt.on('-s', '--source_directory STRING', 'The directory of source') { |option| @options.source_directory = option }
|
|
opt.on('-p', '--pods_directory STRING', 'The directory of pods') { |option| @options.pods_directory = option }
|
|
opt.on('-c', '--check_mode MODE', 'The mode of check is "fully" or "simplified"') { |option| @options.check_mode = option }
|
|
opt.on('-u', '--use_multiple BOOL', 'The flag indicates the use of multiple yaml swiftlint configurations') { |option| @options.use_multiple = option }
|
|
opt.on('-d', '--source_date DATE', 'The date of grouping files according touchin and old swiftlint rules') { |option| @options.source_date = option }
|
|
opt.on('-y', '--touchin_swiftlint_yaml_path STRING', 'The path to the touchin swiftlint yaml relative to the source directory') { |option| @options.touchin_swiftlint_yaml_path = option }
|
|
opt.on('-g', '--depth_git_count Int', 'The depth between the git directory and sources directory') { |option| @options.depth_git_count = option }
|
|
end.parse!
|
|
|
|
if @options.check_mode.to_s.nilOrEmpty?
|
|
@options.check_mode = 'fully'
|
|
end
|
|
|
|
if @options.use_multiple.to_s.nilOrEmpty?
|
|
@options.use_multiple = 'false'
|
|
end
|
|
|
|
if @options.depth_git_count.to_s.nilOrEmpty?
|
|
@options.depth_git_count = 0
|
|
end
|
|
|
|
if @options.touchin_swiftlint_yaml_path.to_s.nilOrEmpty?
|
|
@options.touchin_swiftlint_yaml_path = '/build-scripts/xcode/.swiftlint.yml'
|
|
end
|
|
end
|
|
|
|
def source_directory
|
|
@options.source_directory
|
|
end
|
|
|
|
def source_date
|
|
@options.source_date
|
|
end
|
|
|
|
def pods_directory
|
|
@options.pods_directory
|
|
end
|
|
|
|
def check_mode
|
|
@options.check_mode
|
|
end
|
|
|
|
def use_multiple
|
|
@options.use_multiple
|
|
end
|
|
|
|
def depth_git_count
|
|
@options.depth_git_count
|
|
end
|
|
|
|
def touchin_swiftlint_yaml_path
|
|
@options.touchin_swiftlint_yaml_path
|
|
end
|
|
end |