Module: Turbulence::CommandLineInterface::ConfigParser
- Defined in:
- lib/turbulence/cli_parser.rb
Overview
I Update a Turbulence::Configuration instance to match the user’s expectations (as expressed in ARGV)
Class Method Summary collapse
Class Method Details
.parse_argv_into_config(argv, config) ⇒ Object
6 7 8 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 37 38 39 40 41 42 43 |
# File 'lib/turbulence/cli_parser.rb', line 6 def self.parse_argv_into_config(argv, config) option_parser = OptionParser.new do |opts| opts. = "Usage: bule [options] [dir]" opts.on('--scm p4|git', String, 'scm to use (default: git)') do |s| case s when "git", "", nil when "p4" config.scm_name = 'Perforce' end end opts.on('--churn-range since..until', String, 'commit range to compute file churn') do |s| config.commit_range = s end opts.on('--churn-mean', 'calculate mean churn instead of cummulative') do config.compute_mean = true end opts.on('--exclude pattern', String, 'exclude files matching pattern') do |pattern| config.exclusion_pattern = pattern end opts.on('--treemap', String, 'output treemap graph instead of scatterplot') do |s| config.graph_type = "treemap" end opts.on_tail("-h", "--help", "Show this message") do puts opts exit end end option_parser.parse!(argv) config.directory = argv.first unless argv.empty? end |