Sha256: 4d6820654418cd94208fe078bc54c097967d1e55a9029aa5b02672bb58a08027

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 KB

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} ( #{card.id} )"
            puts "| Description: #{card.description}" if @options[:description]
            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

            opts.on("-d", "--description", "Include description." ) do |o|
              @options[:description] = o
            end
          end
        end

        def help
          puts option_parser.help
        end

      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
trello_cli-0.3.0 lib/trello_cli/cli/card/list.rb
trello_cli-0.2.1 lib/trello_cli/cli/card/list.rb
trello_cli-0.2.0 lib/trello_cli/cli/card/list.rb
trello_cli-0.1.0 lib/trello_cli/cli/card/list.rb