Sha256: c6b3af588e1feed02e4b7bd8b64614bb3e7f1fbb1440e2bd66ab6b3ee6623acd

Contents?: true

Size: 1.3 KB

Versions: 6

Compression:

Stored size: 1.3 KB

Contents

module TrelloCli
  module CLI
    module Card
      class Create

        def initialize
          @options = {}
        end

        def run
          option_parser.parse!

          card        = create_card
          name        = card.attributes[:name]
          description = card.attributes[:description]

          puts "Card Created."
          puts "Name        : #{name}"
          puts "Description : #{description}"
        end

        private

        def create_card
          cc = TrelloCli::Requests::CreateCard.new
          cc.create @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("-d", "--description [DESCRIPTION]", "Description Of Card") do |d|
              @options[:description] = d
            end

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

            opts.on("-n", "--name [NAME]", "Name Of Card") do |n|
              @options[:name] = n
            end
          end
        end

        def help
          puts option_parser.help
        end

      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
trello_cli-0.2.1 lib/trello_cli/cli/card/create.rb
trello_cli-0.2.0 lib/trello_cli/cli/card/create.rb
trello_cli-0.1.0 lib/trello_cli/cli/card/create.rb
trello_cli-0.0.4 lib/trello_cli/cli/card/create.rb
trello_cli-0.0.3 lib/trello_cli/cli/card/create.rb
trello_cli-0.0.2 lib/trello_cli/cli/card/create.rb