lib/exrt/cli.rb in exrt-cli-0.1.0 vs lib/exrt/cli.rb in exrt-cli-0.2.0

- old
+ new

@@ -1,8 +1,9 @@ require "exrt/cli/version" require "thor" require "exrt" +require_relative 'cli/renderer' module Exrt module Cli class CLI < Thor class_option :base, :type => :string, :default => "USD" @@ -11,11 +12,12 @@ desc "latest --base --symbols", "show latest exchange rates" def latest base = options["base"] symbols = options["symbols"] response = Exrt::Rate.latest(base: base, symbols: symbols) - puts response + r = Exrt::Cli::Renderer.new(d: response, t: Exrt::Cli::LATEST) + puts r.render end desc "history --base --symbols --start_at --end_at", "show history exchange rates" option :start_at, :type => :string, :required => true option :end_at, :type => :string, :required => true @@ -26,10 +28,11 @@ base: base, symbols: symbols, start_at: options["start_at"], end_at: options["end_at"] ) - puts response + r = Exrt::Cli::Renderer.new(d: response, t: Exrt::Cli::HISTORY) + puts r.render end end end end