Class: CukeStepBm::Cli::Options
- Inherits:
-
Object
- Object
- CukeStepBm::Cli::Options
- Defined in:
- lib/cuke-step-bm/cli.rb
Instance Method Summary collapse
-
#parse!(args) ⇒ Object
SCOPES = [:step, :feature].
Instance Method Details
#parse!(args) ⇒ Object
SCOPES = [:step, :feature]
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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/cuke-step-bm/cli.rb', line 11 def parse!(args) = {} opt_parser = OptionParser.new("", 30, ' ') do |opts| opts. = "Usage: cuke-step-bm options" opts.on("-f", "--feature FEATURE", String, "In specify feature") do |feature| [:feature] = feature end opts.on("-M", "--most", "Show the most time-consuming step") do [:act] = [ :most ] end opts.on("-t", "--total", "Show the total time-consuming") do [:act] = [ :total ] end opts.on("-w", "--within from,to", Array, "Show the steps time-consuming within the given range (use: -w 1,2)") do |from_to| if from_to.size < 2 puts "wrong argument size" exit end [:act] = [ :within, [from_to.first, from_to.last] ] end opts.on("-l", "--less VALUE", Float, "Show the steps time-consuming less than or equal the given(Mean value)") do |v| [:act] = [ :less, v ] end opts.on("-m", "--more VALUE", Float, "Show the steps time-consuming more than or equal the given(Mean value)") do |v| [:act] = [ :more, v ] end #opts.on("-s", "--scope value", "Show messages within scope (all/feature_filepath)") do |v| # v = v.to_sym # v = :step unless SCOPES.include? v # options[:scope] = v #end opts.separator "" opts.separator "Common options:" opts.on_tail("-h", "--help", "Show this usage message") do puts opts exit end opts.on_tail("-v", "--version", "Show version") do puts "cuke-step-bm #{CukeStepBm::VERSION}" exit end end opt_parser.parse! args end |