Sha256: 086ebf9e116d0777904fb3e284deac0c66f03f4fc1c999a576ebadd2b96ee69e
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
#!/usr/bin/env ruby require 'optparse' require 'methadone' require 'estimator' class App include Methadone::Main include Methadone::CLILogging main do |value, time| estimator_db_name = options.fetch( :file, 'estimator_db.yml' ) estimator_db_path = "#{Dir.pwd}/#{estimator_db_name}" debug "creating estimator with db [#{estimator_db_path}]" fm = Estimator::Estimate.new( estimator_db_path ) # TODO: check for exception fm.load unless value.nil? time = fm.add_value( value.to_f, time ) info "added #{value} on #{time}" else if options[:'last-estimate'] info fm.last_estimate else info fm.estimate end end fm.save! end description 'Estimate remaining time based on previous values' on '--file NAME', 'Database file name' on '--last-estimate', 'Show last estimate (saved on database)' arg :value, :optional, 'Value to estimate' arg :time, :optional, 'When the value happened' version Estimator::VERSION use_log_level_option go! end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
estimator-0.0.4 | bin/estimator |