Class: MetricFu::Cli::Helper
- Inherits:
-
Object
- Object
- MetricFu::Cli::Helper
- Defined in:
- lib/metric_fu/cli/helper.rb
Instance Method Summary collapse
- #banner ⇒ Object
- #executable_name ⇒ Object
-
#initialize ⇒ Helper
constructor
A new instance of Helper.
- #metrics ⇒ Object
- #process_options(argv = []) ⇒ Object
- #run(options = {}) ⇒ Object
- #shutdown ⇒ Object
- #usage ⇒ Object
- #version ⇒ Object
Constructor Details
Instance Method Details
#banner ⇒ Object
32 33 34 |
# File 'lib/metric_fu/cli/helper.rb', line 32 def "MetricFu: A Fistful of code metrics" end |
#executable_name ⇒ Object
43 44 45 |
# File 'lib/metric_fu/cli/helper.rb', line 43 def executable_name "metric_fu" end |
#metrics ⇒ Object
47 48 49 |
# File 'lib/metric_fu/cli/helper.rb', line 47 def metrics MetricFu::Metric.metrics.map(&:name).sort_by(&:to_s) end |
#process_options(argv = []) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/metric_fu/cli/helper.rb', line 51 def (argv = []) = MetricFu::Cli::MicroOptParse::Parser.new do |p| p. = p.version = version p.option :run, "Run all metrics with defaults", default: true metrics.each do |metric| p.option metric.to_sym, "Enables or disables #{metric}", default: true # , :value_in_set => [true, false] end p.option :open, "Open report in browser (if supported by formatter)", default: true end.process!(argv) end |
#run(options = {}) ⇒ Object
18 19 20 21 |
# File 'lib/metric_fu/cli/helper.rb', line 18 def run( = {}) @metric_fu.run() complete end |
#shutdown ⇒ Object
27 28 29 30 |
# File 'lib/metric_fu/cli/helper.rb', line 27 def shutdown out "\nShutting down. Bye" MetricFu::Cli.immediate_shutdown! end |
#usage ⇒ Object
36 37 38 39 40 41 |
# File 'lib/metric_fu/cli/helper.rb', line 36 def usage <<-EOS #{} Use --help for help EOS end |