Sha256: 670aeead9cee5fad69b45ae3703b0cb689d7ed9e4c93a019ac4ff01edd3ecbf0

Contents?: true

Size: 936 Bytes

Versions: 1

Compression:

Stored size: 936 Bytes

Contents

module TrelloCli
  module CLI
    module Board
      class List

        def initialize
          @options = {}
        end

        def run
          option_parser.parse!

          list_boards.each do |board|
            return unless !board.attributes[:closed] || @options[:closed]
            name = board.attributes[:name]
            id   = board.attributes[:id]

            puts "#{name} ( #{id} )"
          end
        end

        private

        def list_boards
          lb = TrelloCli::Requests::ListBoards.new
          lb.list
        end

        def option_parser(options=@options)
          OptionParser.new do |opts|
            opts.banner = "Usage: trello board [list]"

            opts.on("-c", "--closed", "Include closed board." ) do |o|
              @options[:closed] = o
            end
          end
        end

        def help
          puts option_parser.help
        end

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
trello_cli-0.2.0 lib/trello_cli/cli/board/list.rb