Sha256: 87dac93d73786147cca86dabeec866511f24783e597a95a0f845d3131b193eb5

Contents?: true

Size: 802 Bytes

Versions: 1

Compression:

Stored size: 802 Bytes

Contents

#!/usr/bin/env ruby

require "thor"
require_relative '../lib/stressfactor'

class CLI < Thor
  desc "analyze PATH", "Run analysis on a GPX."
  options units: :string
  def analyze(path)
    units = options[:units] || :metric
    units = units.to_sym

    units_help = units == :metric ? "min/km" : "min/mi"
    puts "Units are #{units}, which are in #{units_help}"

    loader = Stressfactor::GpxLoader.new(path)
    pc = Stressfactor::PaceCalculator.new(loader)
    puts "Grade Adjusted Pace: #{pc.calculate(strategy: :grade_adjusted, units: units)}"
    puts "Raw Pace: #{pc.calculate(strategy: :raw, units: units)}"

    pace = 3.8
    stress = Stressfactor::StressCalculator.new(threshold_pace: pace, loader: loader)
    puts "Training stress score: #{stress.calculate}"
  end
end

CLI.start(ARGV)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stressfactor-0.0.1 bin/stressfactor