Sha256: eabfa194169f9c574781090efe179106987ad5d39fb104e04de3800342ef656f

Contents?: true

Size: 974 Bytes

Versions: 2

Compression:

Stored size: 974 Bytes

Contents

module TrelloCli
  module CLI
    module Card
      class List

        def initialize
          @options = {}
        end

        def run
          option_parser.parse!

          list_cards.each do |card|
            puts "| Name: #{card.name}"
            puts "| Description: #{card.name}"
            puts "|------------------------"
          end
        end

        private

        def list_cards
          TrelloCli::Requests::ListCards.new.list @options
        end

        def option_parser
          OptionParser.new do |opts|
            opts.banner = "Usage: trello card [create] [options]"

            opts.on("-b", "--board [BOARD]", "Trello Board Id") do |b|
              @options[:board_id] = b
            end

            opts.on("-l", "--list [LIST]", "List To Query") do |l|
              @options[:list_id] = l
            end
          end
        end

        def help
          puts option_parser.help
        end

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
trello_cli-0.0.3 lib/trello_cli/cli/card/list.rb
trello_cli-0.0.2 lib/trello_cli/cli/card/list.rb