Sha256: 55e7e6029a3057d9fb6a23442c8f3bb126ea07dc2ef18cf25bbdf2701bca088d

Contents?: true

Size: 545 Bytes

Versions: 1

Compression:

Stored size: 545 Bytes

Contents

require "thor"
require "punky_brewster"
require "nokogiri"
require "open-uri"

module PunkyBrewster
  class CLI < Thor
    map "--version" => :version

    desc "version", "Show version"
    def version
      say "Punky Brewster version #{VERSION}"
    end

    desc "list", "Show current beer list"
    def list
      beers = BeerListRequest.new.beers

      rows = beers.sort_by(&:name).map do |beer|
        [beer.name, "$%0.2f/L" % beer.price, "%0.1f%" % beer.abv]
      end

      print_table rows
    end

    default_task :list
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
punky_brewster-1.0.1 lib/punky_brewster/cli.rb