module WeatherSage::CLI

Command-line interface for weather-sage.

Public Class Methods

run(app, args) click to toggle source

Entry point for command-line interface.

# File lib/weather-sage/cli.rb, line 13
def self.run(app, args)
  require 'csv'
  require 'logger'
  require 'fileutils'

  args = ['help'] unless args.size > 0

  # wrap environment and create context
  env = Env::Env.new(ENV)
  ctx = Env::Context.new(env)

  # map first argument to command, then run it
  (Commands.const_get('%sCommand' % [
    args.shift.capitalize
  ]) || Commands::HelpCommand).run(ctx, app, args)
end